Skip to Content
Data Structures the Fun Way
book

Data Structures the Fun Way

by Jeremy Kubica
October 2022
Beginner to intermediate
304 pages
8h 30m
English
No Starch Press
Content preview from Data Structures the Fun Way

4 Stacks and Queues

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Grokking Data Structures

Grokking Data Structures

Marcello La Rocca
Grokking Algorithms

Grokking Algorithms

Aditya Bhargava

Publisher Resources

ISBN: 9781098156602Errata Page