
Stack
Chapter 19
Stack ADT and Implementation
package collection.positional
Stack<E>
Uses: Array (Chapter 11), DynamicArray (Chapter 13), SinglyLinkedList (Chapter 15)
Used By: Object Pool (Section 5.5)
Strengths: More specialized than a buffer, a stack is natural for applications that insert and remove
elements only at one end of the buffer. That is, a stack implements a last-in-first-out (LIFO) line. By
providing restricted access, it helps prevent accidental misuse of the data structure. Also, since all
updates to the stack are made at one end, an efficient array-based implementation can be achieved
with a non-circular array, and an efficient list-based ...