Open
Description
Why does a double-ended queue require a doubly-linked list? This can be implemented with a singly-linked list
- push front - insert before the head node
- pop front - remove the head node, point to the following node
- push back - append to the tail
- pop back - remove the tail node
In all cases, you maintain a pointer to head and tail.
The only time a doubly-linked list would make sense is if you need to iterate through the entire list front-to-back and back-to-front.
Metadata
Metadata
Assignees
Labels
No labels
Activity