Data Structure: Stack - CBSE Class 12 Computer Science Notes, Diagrams and Solved Questions
The stack as a last-in, first-out structure: push, pop, peek and isEmpty with a Python list, overflow and underflow, tracing stack operations, real uses such as undo, and board-style push-and-pop programs.
In this chapter
What a stack is and why it is LIFO
Implementing a stack with a Python list
Writing push, pop, peek, isEmpty and display functions
Stack underflow and overflow
Tracing a sequence of stack operations
Where stacks are used: undo, Back button, reversing
Board-style programs that push items meeting a condition and pop them all