Stack & Queues Flashcards
1
Q
What are the Stack’s operations?
A
pop(): Remove the top item from the stack.
push( item): Add an item to the top of the stack.
peek( ): Return the top of the stack.
isEmpty(): Return true if and only if the stack is empty.
2
Q
What are the Queue’s operations?
A
- add (item): Add an item to the end of the list.
- remove(): Remove the first item in the list.
- peek(): Return the top of the queue.
- isEmpty(): Return true if and only if the queue is empty.