There is no doubt that there are numerous data structures that can be used to implement data structures, queues, stacks and linked lists. Each of them has its own functionality, usage and advantage. The double ended queue is a version of a FIFO queue. The double ended queue can be implemented as a single array, with one half used to hold the items and the other half used to hold information on which items have been removed from the front of the array. These Questions on Double Ended Queue and answers packaged in this PDF file will help you prepare for any exam including GATE, GRE, IES, PSC, UGC NET, DOEACC Exams at all levels – you just have to practice regularly.
Questions on Double Ended Queue – Data Structure MCQs
1. What is a dequeuer?
a) A queue with insert/delete defined for both front and rear ends of the queue
b) A queue implemented with a doubly linked list
c) A queue implemented with both singly and doubly linked lists
d) A queue with insert/delete defined for front side of the queue
Answer: A queue with insert/delete defined for both front and rear ends of the queue
2. What are the applications of dequeue?
a) A-Steal job scheduling algorithm
b) Can be used as both stack and queue
c) To find the maximum of all sub arrays of size k
d) To avoid collision in hash tables
Answer: To avoid collision in hash tables
3. After performing these set of operations, what does the final list look contain?
InsertFront(10); InsertFront(20); InsertRear(30); DeleteFront(); InsertRear(40); InsertRear(10); DeleteRear(); InsertRear(15); display();
a) 10 30 10 15
b) 20 30 40 15
c) 20 30 40 10
d) 10 30 40 15
Answer: 10 30 40 15
4. What is the time complexity of deleting from the rear end of the dequeue implemented with a singly linked list?
More Questions on Abstract Data Types (Data Structure)
Some FAQs and Answers on Double Ended Queue
1. What do you mean by double ended queue?
Answer: Double-ended queue (deque) is a data structure that combines the best features of the queue and the list. It provides all the capabilities of lists, including fast insertion and deletion at both ends, but also maintains the ordering property of the queue.
2. Why double ended queue is used?
Answer: Double ended queue is a more generalized form of queue data structure which allows insertion and removal of elements from both the ends, i.e, front and back. A linked list is one such implementation of double ended queue. It maintains no specific order to sequence of nodes, which can be inserted and removed at any given time from its two ends – front and back – without affecting the order of other elements in the list.
3. What is double ended queue in C?
Answer: Double Ended Queue in C is also referred to as deque or dequier. The deque is the data structure which stores the elements in last-in, first-out (LIFO) order, same as stack. Unlike the queue, it allows insertion and removal of elements from both ends of the structure. The deque provides two interfaces, front and rear.
4. Is double ended queue a circular queue?
Answer: Deque or Double Ended Queue is a generalized version of Queue data structure that allows insert and delete at both ends. In previous post we had discussed introduction of deque. Now in this post we see how we implement deque Using circular array.
5. What is double queue and its advantages?
Answer: With double ended queues, we are able to remove and add items from both the front and the back of the queue. In a queue, we can only add data to the back and remove it from the front.
6. What is disadvantage of linear queue?
Answer: In a linear queue, the traversal through the queue is possible only once ,i.e., once an element is deleted, we cannot insert another element in its position. This disadvantage of a linear queue is overcome by a circular queue, thus saving memory.