Stacks Flashcards
(6 cards)
1) Stack - Definition
A stack is a d__________ set.
When we delete an element from a stack, it is the last element in the list. LIFO = Last In First out.
When we insert an element into a stack it goes at the end (on the tail).
dynamic
2) How to Implement Stacks
There are several efficient ways to implement stacks, for now, we will be using a________.
array
3) Operations
The insert operation is called = p_______
The delete operation is called = p______
To check if our stack is empty we use = S_____-E_______
They all take O(1) time.
push
pop
STACK-EMPTY
4) S.top
When we create a stack using an array, we need to create a pointer
(a variable) called S.top that points to the most recently inserted element.
Underflow and Overflow
If we try to PUSH a new item into a list that is full, it is called O___________.
If we try to delete an item from an empty list it is called U__________
overflow
underflow