Mental Model
A stack stores items in order, last in first out. It can be built using a linked list or an array, each with different strengths and weaknesses.
Analogy: Imagine a stack of plates. Using an array is like a fixed-size shelf where plates are stacked neatly but limited by shelf size. Using a linked list is like stacking plates on a flexible tower where you can add or remove plates without worrying about space but with a bit more overhead.
Array Stack: [0] 5 [1] 3 [2] 7 [3] _ [4] _ Top -> [2] Linked List Stack: 7 -> 3 -> 5 -> null ā Top
