Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Stacks

https://www.crazygames.com/game/stack-online
Stacks
Dynamic Data Structure
LIFO (Last in First Out) - the last element
to be “pushed” (inserted) into the stack
is the first to be removed (“popped”)
Used to keep track of function calls.
Stacks
Dynamic Data Structure
LIFO (Last in First Out) - the last element
to be “pushed” (inserted) into the stack
is the first to be removed (“popped”)
Used to keep track of function calls.
Stacks - Basic Tasks

▪ Add and remove values from a stack


▪ Completely empty a stack
▪ Transfer from array to stack and vice-versa
▪ Count the number of values in a stack
Stacks
Practice Problems

You might also like