Recall & Review
beginner
What does the push operation do in a stack?
It adds a new element to the top of the stack, increasing its size by one.
Click to reveal answer
beginner
In a stack, what happens if you try to push an element when the stack is full?
This situation is called stack overflow, and the push operation cannot add the new element.
Click to reveal answer
beginner
What is the time complexity of the push operation on a stack?
The push operation runs in O(1) time because it only adds an element at the top without traversing the stack.
Click to reveal answer
beginner
Show the state of the stack after pushing elements 5, then 10, then 15.
Stack top -> 15 -> 10 -> 5 -> null
Click to reveal answer
beginner
Why is the stack called LIFO?
Because the last element pushed onto the stack is the first one to be removed, following Last In First Out order.
Click to reveal answer
What does the push operation do in a stack?
✗ Incorrect
Push adds a new element to the top of the stack.
What is stack overflow?
✗ Incorrect
Stack overflow happens when pushing to a full stack.
What is the time complexity of push operation?
✗ Incorrect
Push runs in constant time O(1).
If stack is empty, what is the top after pushing 7?
✗ Incorrect
After pushing 7, top points to 7.
Which order does stack follow?
✗ Incorrect
Stack follows Last In First Out (LIFO) order.
Explain the push operation on a stack and what happens when the stack is full.
Think about adding an item on top and what limits the stack size.
You got /4 concepts.
Describe how the stack looks after pushing elements 3, 6, and 9 in that order.
Visualize stacking plates one on top of another.
You got /3 concepts.
