liveBook · Manning

Stack

A stack is a data structure that adds and removes elements at one end, following last-in, first-out order.

How 14 Manning books explain it

Classic Computer Science Problems in Swift: Essential techniques for practicing programmers

A stack is a last-in-first-out data structure in which insertion and removal occur at the same end.

How it is used
Models top-only disc moves and holds the frontier of a depth-first maze search.
How deep it goes
Defines LIFO, implements a generic Array-backed stack, and addresses empty pops; stops short of enforcing Hanoi’s disc-size rule.
Examples
Uses Towers of Hanoi disc transfers and a maze-search frontier.
What you can do after
Build it from scratch as a generic Swift Array-backed stack and apply it to Hanoi moves or a depth-first frontier.

Read how Classic Computer Science Problems in Swift: Essential techniques for practicing programmers explains stack →

Grokking Data Structures

Stack is the book's class that implements a stack interface by wrapping an underlying linked list.

How it is used
Uses a LIFO container to handle the most recent entry first in expression evaluation, undo, and path retracing.
How deep it goes
Defines the interface, develops a Python linked-list wrapper, compares storage costs, and examines peek pitfalls.
Examples
Illustrates LIFO with dishes and patient forms, then works through postfix evaluation, undo/redo, and game-path retracing.
What you can do after
Build it from scratch as a Python wrapper around a singly linked list and choose it when latest-first access fits.

Read how Grokking Data Structures explains stack →

Get Programming: Learn to code with Python

A data structure in which elements are added and removed from the same end, so the most recently added element is removed first.

How it is used
Uses a stack to organize items so the newest item is removed first.
How deep it goes
Defines a list-backed Stack class and demonstrates its methods with strings and objects.
Examples
Uses pancake flavors and Circle objects to demonstrate adding, removing, and storing items.
What you can do after
Build it from scratch with a Python class that stores items in a list and provides stack operations.

Read how Get Programming: Learn to code with Python explains stack →

.NET in Action, Second Edition

A stack is a runtime memory region that stores function-local variables, arguments, and return addresses using call-order allocation.

How it is used
Connects active method calls to CPU profiling and distinguishes call storage from dynamic heap allocation.
How deep it goes
Explains frames, call-and-return behavior, stored data, and overflow without detailing byte-level frame layout.
Examples
Uses a nested method-call diagram and C++ and C# runtime-sized array listings.
What you can do after
Diagnose/debug with it by interpreting profiled call frames and recognizing recursion-driven stack overflow.

Read how .NET in Action, Second Edition explains stack →

Fabulous Adventures in Data Structures and Algorithms

A stack is a last-in, first-out data structure supporting insertion and removal at one end.

How it is used
Uses explicit stacks to track pending work in nonrecursive pretty-printing algorithms.
How deep it goes
Works through two stack-based traversals, including loop termination, width checks, and per-task state; does not implement a stack collection.
Examples
Uses C# Fits and Pretty methods to show stacks of documents and tuples carrying formatting state.
What you can do after
Build it from scratch as a nonrecursive document traversal using an existing Stack collection.

Read how Fabulous Adventures in Data Structures and Algorithms explains stack →

Modern C

A stack is a last-in, first-out data structure in which values are added and removed at one end.

How it is used
Uses the stack to explain intermediate-value algorithms and the memory state established for C function execution.
How deep it goes
Explains stack-frame setup, register roles, offsets, and uninitialized reserved space, but stops short of a broader stack interface.
Examples
Traces fgoto through assembler instructions that save %rbp, establish a frame, reserve 48 bytes, and initialize local variables.
What you can do after
Evaluate assembler output by locating function data through stack-pointer setup, base-pointer offsets, and register movements.

Read how Modern C explains stack →

Refactoring to Rust

A stack is a last-in-first-out memory region or abstract data structure used for values such as function-call state and local variables.

How it is used
Organizes local variables and function-call data during program execution.
How deep it goes
Defines stack behavior, capacity, and contrast with heap storage without detailing implementation internals.
Examples
Uses a welcome function and patron name to illustrate local values, allocation, and memory cleanup.
What you can do after
Evaluate/understand whether data belongs conceptually on the stack or heap.

Read how Refactoring to Rust explains stack →

Modern C, Third Edition

A stack is a last-in, first-out storage structure in which function-call contexts are added and removed as calls and returns occur.

How it is used
Models function-call storage and explains how local objects occupy machine-level stack frames.
How deep it goes
Explains push-and-pop behavior, registers, offsets, recursion, and VLA risks, but notes that C provides no tool to predict stack exhaustion.
Examples
Uses the fgoto assembly listing, stack-frame offsets, unbounded recursion, and variable-length arrays as concrete cases.
What you can do after
Evaluate assembly stack-frame setup and recognize recursion or variable-length arrays as potential sources of stack overflow.

Read how Modern C, Third Edition explains stack →

Functional Programming in JavaScript

A last-in, first-out data structure in which elements are added and removed from one end called the top.

How it is used
Explains function execution, nested calls, and memory growth in JavaScript.
How deep it goes
Defines LIFO and traces frame creation, scope links, memory use, nesting, currying, and recursion.
Examples
Uses a dish pile, logger invocation, recursive increment, and longest-string recursion to illustrate stack behavior.
What you can do after
Evaluate how JavaScript calls pause, resume, allocate frames, and grow the execution stack.

Read how Functional Programming in JavaScript explains stack →

Latency

A stack is a memory region that supports function execution by storing call state, registers, return information, and local data.

How it is used
Supports function execution and provides constant-time boundary operations for latency-sensitive data handling.
How deep it goes
Explains stack frames, saved registers, return information, address growth, and lazy allocation, but defers architecture-specific implementation details.
Examples
Uses function calls, local variables, saved registers, return information, and process-memory diagrams as examples.
What you can do after
Evaluate stack suitability by relating function-execution behavior and insertion, deletion, and search complexity to latency-sensitive workloads.

Read how Latency explains stack →

Advanced Algorithms and Data Structures

A stack is a container abstraction in which removal returns the most recently inserted element that remains, following last-in-first-out order.

How it is used
Models last-in-first-out storage and supplies the traversal container for depth-first search.
How deep it goes
Defines insertion and removal, then frames representation choices without specifying a complete concrete implementation.
Examples
Uses piles of files or dishes and depth-first search with backtracking as concrete illustrations.
What you can do after
Apply a stack as the container that drives depth-first traversal and backtracking.

Read how Advanced Algorithms and Data Structures explains stack →

Grokking AI Algorithms, Second Edition

A stack is a linear data structure in which elements are added and removed from the same end.

How it is used
Uses a LIFO stack to drive depth-first search through nodes and maze positions.
How deep it goes
Defines LIFO and traces stack operations through DFS, including visited checks, goal tests, and backtracking.
Examples
Demonstrates root-node search, maze movement, neighbor processing, and a DFS implementation listing.
What you can do after
Build it from scratch by initializing, popping, checking, and appending items in a DFS stack.

Read how Grokking AI Algorithms, Second Edition explains stack →

Learn Rust in a Month of Lunches

The stack is a memory region that stores values with a known size and releases them in last-in, first-out order as execution leaves scopes or functions.

How it is used
Explains how Rust stores values and releases memory while introducing memory, variables, and ownership.
How deep it goes
Defines speed, last-in-first-out release, compile-time sizing, heap pointers, and embedded limitations without detailing implementation internals.
Examples
Uses a stack of dishes, an i32 value, heap data with a stack pointer, and a small embedded device.
What you can do after
Understand why some Rust values use the stack and how pointers connect stack locations to heap data.

Read how Learn Rust in a Month of Lunches explains stack →

Optimization Algorithms: AI techniques for design, planning, and control problems

A last-in, first-out data structure in which elements are added to and removed from the same end.

How it is used
Supports depth-first search by prioritizing the most recently discovered node and enabling backtracking through a graph.
How deep it goes
Explains initialization, push and pop operations, successor filtering, and termination within DFS, without examining implementation internals.
Examples
Uses depth-first search on the 8-puzzle and path-planning problems to demonstrate stack-based exploration.
What you can do after
Apply it via depth-first search to prioritize deep graph exploration and return to earlier decision points after dead ends.

Read how Optimization Algorithms: AI techniques for design, planning, and control problems explains stack →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.