Lec-5
Stacks
STACK
LIFO
Last In First Out
What is a Stack?
a. A Stack is a linear data structure that follows the
Last In First Out (LIFO) principle.
b. Only one element is accessible at a time – the
top element.
c. Operations are performed from one end (top of
the stack).
Real-World Examples of Stack
a. Books in a pile: The last book placed is the first
to be taken out.
b. Plates in Mess: You stack plates one on top of
the other; you take the top one when needed.
STACK MEMORY
PROBLEMS
https://www.geeksforgeeks.org/problems/reverse-an-array/1?
itm_source=geeksforgeeks&itm_medium=article&itm_campaign=practice_card
https://leetcode.com/problems/valid-parentheses/
https://leetcode.com/problems/next-greater-element-ii/
https://leetcode.com/problems/asteroid-collision
https://leetcode.com/problems/largest-rectangle-in-histogram