Download presentation
Presentation is loading. Please wait.
Published bySamuel Perry Modified over 9 years ago
1
Stacks
2
What is a Stack? A stack is a type of data structure (a way of organizing and sorting data so that it can be used efficiently). To be specific, it’s a collection of objects that are inserted and removed according to the last in first out principle
3
It kind of like a pez dispenser When you add something to a stack it gets “pushed” onto the stack. And when something is removed it gets “popped” from the stack
4
Functions of a Stack Push- Inserts element e the top of the stack Pop- Removes the top element from the stack and returns it as a value Size- Returns the number of elements in a particular stack isEmpty- Tells whether the stack is empty or not Top- Returns the value top element of the stack
5
REAL LIFE EXAMPLES??? Web browsers use a stack to store the addresses of recently visited pages. New addresses get “pushed”. While pushing back button “pops” the previous page.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.