Chapter 17 - Stacks and Queues
Chapter 17 - Stacks and Queues
C++ Programming: Program Design Including Data Structures, Sixth Edition 100
Summary
• Stack: items are added/deleted from one end
– Last In First Out (LIFO) data structure
– Operations: push, pop, initialize, destroy, check for
empty/full stack
– Can be implemented as array or linked list
– Middle elements should not be accessed directly
• Postfix notation: operators are written after the
operands (no parentheses needed)
C++ Programming: Program Design Including Data Structures, Sixth Edition 101
Summary (cont’d.)
• Queue: items are added at one end and removed
from the other end
– First In First Out (FIFO) data structure
– Operations: add, remove, initialize, destroy, check if queue
is empty/full
– Can be implemented as array or linked list
– Middle elements should not be accessed directly
– Is a restricted version of array and linked list
C++ Programming: Program Design Including Data Structures, Sixth Edition 102