Recall & Review
beginner
What is a key advantage of using a linked list to implement a stack?
A linked list stack can grow and shrink dynamically without a fixed size limit, so it uses memory efficiently for varying stack sizes.
Click to reveal answer
beginner
What is a main limitation of an array-based stack?
An array stack has a fixed size, so it can overflow if too many elements are pushed beyond its capacity.
Click to reveal answer
beginner
Why is accessing the top element in both linked list and array stacks efficient?
Both implementations allow direct access to the top element in constant time O(1) because the top is always at a known position.
Click to reveal answer
intermediate
How does memory usage differ between linked list and array stacks?
Linked list stacks use extra memory for pointers in each node, while array stacks use contiguous memory but may waste space if not fully used.
Click to reveal answer
intermediate
Which stack implementation is generally faster for push and pop operations and why?
Array stacks are generally faster because they have better cache locality and no pointer overhead, making push/pop operations quicker.
Click to reveal answer
What happens when you push an element onto a full array stack?
✗ Incorrect
Array stacks have fixed size, so pushing beyond capacity causes overflow.
Which stack implementation uses extra memory for pointers?
✗ Incorrect
Linked list stacks store pointers in each node to link elements.
Which stack type allows dynamic resizing without manual intervention?
✗ Incorrect
Linked list stacks grow and shrink dynamically as nodes are added or removed.
What is the time complexity of push operation in both stack types?
✗ Incorrect
Push operation is constant time O(1) in both array and linked list stacks.
Which stack implementation benefits more from CPU cache locality?
✗ Incorrect
Array stacks store elements contiguously, improving cache performance.
Explain the main trade-offs between using a linked list stack and an array stack.
Think about size flexibility, memory overhead, and speed.
You got /4 concepts.
Describe scenarios where a linked list stack is preferred over an array stack and vice versa.
Consider stack size predictability and performance needs.
You got /4 concepts.
