Topic Wise Lesson Plane
Introduction to Stacks.
A stack is a linear data structure that follows the rule:
LIFO – Last In, First Out
Basic Stack Operations
Here are the main operations you’ll see everywhere:
-
Push – Add an element to the top of the stack
-
Pop – Remove the top element from the stack
-
Peek / Top – View the top element without removing it
-
isEmpty – Check if the stack is empty
-
isFull – Check if the stack is full (for fixed-size stacks)
Simple Example
Push 10
Push 20
Push 30
Stack now looks like:
Top → 30
20
10
If you Pop, you remove 30.