Deque
Insert and remove at both ends in O(1).
Deque: Push and pop at both ends
pop-back returns 3, the item at the back. The other end is untouched. Size 2.
Cost
- Push front
- O(1)
- Push back
- O(1)
- Pop front
- O(1)
- Pop back
- O(1)
- Space
- O(n)
Before this
Related
Leads to
Topics that need this one first.