0% found this document useful (0 votes)
5 views

Stack

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Stack

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

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

You might also like