Stack - FILO data structure
- could be
implemented
withArray
orLinkedList
- use
helper stack
to assist getMin, getMax, reverse, swap or replace element - use stack to store the index of the element instead of the element itself
- use queue to implement stack(tmp queue & body queue, offer and poll, swap reference)
Queue - FILO data structure
- could be
implemented
withArray
orLinkedList
- store index
- use stack to implement queue, two stack swap reference, push O(n), pop O(1), peek O(1)