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 needing a fixed size, so it uses memory efficiently.
Click to reveal answer
beginner
What is a main limitation of using an array to implement a stack?
An array stack has a fixed size, so it can run out of space if too many items are pushed.
Click to reveal answer
intermediate
Which stack implementation generally has faster access times, array or linked list?
Array stacks usually have faster access because elements are stored contiguously in memory, improving cache performance.
Click to reveal answer
intermediate
Why might a linked list stack use more memory than an array stack?
Each node in a linked list stores extra information (a pointer to the next node), which adds overhead compared to array elements.
Click to reveal answer
beginner
What happens when you try to push an element onto a full array stack?
You get a stack overflow error or need to resize the array, which can be costly in time.
Click to reveal answer
Which stack implementation allows dynamic size without resizing?
✗ Incorrect
Linked list stacks grow and shrink dynamically, while array stacks have fixed size unless resized.
What extra memory does a linked list node store compared to an array element?
✗ Incorrect
Each linked list node stores a pointer to the next node, adding memory overhead.
Which stack implementation typically has better cache performance?
✗ Incorrect
Array stacks store elements contiguously, improving cache locality and speed.
What is a common problem when pushing onto a full array stack?
✗ Incorrect
Pushing onto a full array stack causes stack overflow unless resized.
Which stack implementation is simpler to implement?
✗ Incorrect
Array stacks are simpler because they use a fixed-size array and an index pointer.
Explain the trade-offs between using a linked list and an array to implement a stack.
Think about size flexibility, memory use, and speed.
You got /5 concepts.
Describe a scenario where a linked list stack is better than an array stack.
Consider dynamic size needs.
You got /3 concepts.