Stacks Flashcards
1
Q
What is a stack?
A
A data structure where values are added to the top and removed from the top
2
Q
What type of data structure is a stack?
A
Last in First Out (LIFO)
3
Q
What error can occur when pushing an item onto the stack?
A
The stack could be full and stack overflow occurs
4
Q
What is the difference between pop and peek?
A
Pop removes an item of the stack and returns it
Peek only looks at the top item