Cheat sheet · Class 12 · CBSE · Science Computer Science
Stack cheat sheet
The whole chapter on one page: key formulas, facts and the points to remember, for quick revision before a test.
CBSE Class 12 · Computer Science
Cheat sheet
Chapter 5Stack
LIFO — Last In, First Out (a pile of plates).
1. Operations
- PUSH: add to top (list.append).
- POP: remove from top (list.pop()).
- PEEK/TOP: view top.
- isEmpty; overflow and underflow.
2. Applications
- Undo in editors; browser back button.
- Reversing a string.
- Matching parentheses.
- Evaluating and converting expressions.
| Notation | Example |
|---|---|
| Infix | A + B * C |
| Prefix (Polish) |
|
| Postfix (reverse Polish) | A B C * + |
3. Postfix Evaluation
Scan left to right: push operands; on an operator pop two, apply, push the result. 2 3 4 * + → 14
4. Key Points
- Underflow: pop from an empty stack.
- Infix → postfix uses operator precedence.
- Function calls use a call stack.
- Python list works as a stack.
Remember: LIFO | push/pop | infix, prefix, postfix
More Class 12 · CBSE · Science Computer Science cheat sheets
Practise Stack
Sign up free to practise the full chapter. Questions you get wrong come back until you've mastered them.
Start practising freeFree to start · No credit card needed