Stacks Flashcards
1
Q
Difference between static and dynamic data structure
A
Static has a fixed size
While dynamic can change
2
Q
How do stacks behave
A
On a First In Last Out (FILO)
3
Q
What are the 5 operations of a stack
A
Peek
Pop
Push
IsEmpty
IsFull
4
Q
What does Peek do
A
Returns the top item without removing it
5
Q
What does Pop do
A
Returns the top item and removes it
6
Q
What does Push do
A
Adds a new item on top
7
Q
What does IsEmpty do
A
Checks if the stack is empty
8
Q
What does IsFull do
A
Check if the list is full.
*In python would be better to check the length as lists in python are dynamic
9
Q
A