Recall & Review
beginner
What is a Dequeue (Double Ended Queue)?
A Dequeue is a data structure where elements can be added or removed from both the front and the rear ends.
Click to reveal answer
beginner
Why use a linked list to implement a Dequeue?
A linked list allows dynamic memory allocation and efficient insertion and deletion at both ends without shifting elements.
Click to reveal answer
beginner
What are the main operations in a Dequeue using linked list?
InsertFront, InsertRear, DeleteFront, DeleteRear, and Display.
Click to reveal answer
intermediate
How does DeleteRear operation work in a singly linked list based Dequeue?
Traverse to the second last node, remove the last node, and update the second last node's next pointer to NULL.
Click to reveal answer
intermediate
What is the time complexity of InsertFront and InsertRear in a linked list based Dequeue?
Both InsertFront and InsertRear operations take O(1) time if a tail pointer is maintained; otherwise, InsertRear takes O(n).
Click to reveal answer
Which operation in a Dequeue adds an element at the front?
✗ Incorrect
InsertFront adds an element at the front end of the Dequeue.
In a linked list based Dequeue, what is the pointer used to keep track of the last node?
✗ Incorrect
The tail pointer keeps track of the last node for efficient rear operations.
What happens when you delete the front element in a Dequeue implemented with a linked list?
✗ Incorrect
Deleting front means moving the head pointer to the next node and freeing the old front node.
Which of these is NOT a valid operation in a Dequeue?
✗ Incorrect
InsertMiddle is not a standard Dequeue operation; Dequeue only allows insertion/removal at ends.
What is the worst-case time complexity of DeleteRear in a singly linked list without a tail pointer?
✗ Incorrect
Without a tail pointer, you must traverse the list to find the second last node, which takes O(n) time.
Explain how to insert an element at the rear end of a Dequeue implemented using a linked list.
Think about how to add a node at the end and update pointers.
You got /4 concepts.
Describe the steps to delete an element from the front of a Dequeue using a linked list.
Focus on removing the first node and updating the head.
You got /4 concepts.
