October 2022
Beginner to intermediate
304 pages
8h 30m
English
This chapter introduces stacks and queues, two data structures that retrieve stored data based on the order in which it was inserted. Stacks and queues are very similar and require only minor implementation differences. However, the simple fact that stacks return the most recently inserted data first, while queues return the oldest, completely changes the behavior of algorithms and the efficiency with which we can access data.
Stacks form the core of depth-first search, which searches deeper and deeper along an individual path until it hits a dead end. Queues enable breadth-first search, which shallowly explores adjacent ...