Basics
Stack & Queue (FIFO) combined
- Linear Data Structure
- Aka Array/Linked List with limitations
Implementation
Implementation with Double Linked List
- Visual
- We need Double Linked List in order to have the ability to pollLast() - delete from the rear. With Single Linked List, we are unable to get the previous node, which means we cant update rear when we delete from the backl
2 implementation comparison
- Similar to Stack implementation comparison
Abstract Data Type (ADT)
O(1) to offerFirst() & offerLast()
- basically push()
O(1) to pollFirst() & pollLast()
- basically pop()
O(1) to peekFirst() & peekLast()