liveBook · Manning

Recursion

Recursion is a computational technique in which a definition or procedure refers to or invokes the same definition or procedure, directly or indirectly.

How 23 Manning books explain it

Fabulous Adventures in Data Structures and Algorithms

A recursive algorithm solves a problem by invoking itself on smaller or simpler instances together with terminating cases.

How it is used
Solves graph coloring, permutation generation, quadtree stepping, and term anti-unification by reducing each problem to smaller instances.
How deep it goes
Develops base cases, recursive calls, result assembly, and failure paths in C#; also examines lazy evaluation and stack-depth costs.
Examples
Uses a four-color map of South America, numbered change-ringing permutations, Life quads, and binary arithmetic terms.
What you can do after
Build it from scratch using explicit base cases, smaller calls, and result assembly; evaluate stack depth and deferred enumeration costs.

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

Functional Programming in JavaScript

A problem-solving technique in which a process is defined in terms of smaller instances of itself until a base case is reached.

How it is used
Solves self-similar problems and parses recursively defined data structures in functional JavaScript.
How deep it goes
Defines base and recursive cases, traces array summation and tree traversal, then examines stack use and tail-call optimization.
Examples
Uses array summation, deep freezing, XML or HTML parsing, graph traversal, tree mapping, and factorial.
What you can do after
Apply it by writing terminating recursive functions and recognizing when tail-recursive state passing can reduce stack growth.

Read how Functional Programming in JavaScript explains recursion →

Software Design for Python Programmers

Recursion is a problem-solving technique that repeatedly applies the same procedure to progressively smaller instances of a problem until a terminating condition is reached.

How it is used
Uses repeated self-calls to reduce problems and explore solution paths in algorithms, trees, sorting, puzzles, and search.
How deep it goes
Explains reduction, base cases, unwinding, backtracking, implementations, and performance risks, but defers formal complexity analysis.
Examples
Demonstrates list algorithms, Towers of Hanoi, binary search trees, quicksort, Fibonacci computation, eight queens, and Sudoku.
What you can do after
Build it from scratch for shrinking subproblems, recursive data structures, sorting, and path-search programs with explicit termination.

Read how Software Design for Python Programmers explains recursion →

Object-Oriented Software Design in C++

A recursive algorithm is an algorithm whose definition or execution invokes the same algorithm on smaller instances of a problem.

How it is used
Explains recursive problem solving through progressively smaller subproblems, data structures, sorting, and path exploration.
How deep it goes
Develops base cases, unwinding, recursive data structures, backtracking, and performance risks through worked C++ examples.
Examples
Uses vector maximum and reversal, Towers of Hanoi, binary search trees, quicksort, Fibonacci, eight queens, and Sudoku.
What you can do after
Build recursive functions with base cases, trace unwinding, implement recursive structures and sorting, and diagnose repeated-call costs.

Read how Object-Oriented Software Design in C++ explains recursion →

Modern C

Recursion is a technique in which a computation is defined or performed through calls or applications that refer to the same computation.

How it is used
Uses recursion to turn greatest-common-divisor and Fibonacci rules into C functions, then to process nested braces in a parser.
How deep it goes
Works through base cases, recursive calls, and call-local state; revisits the complication of shared pointed-to state.
Examples
Traces gcd2(18, 30), contrasts three Fibonacci implementations, and applies recursive descent to brace indentation.
What you can do after
Build it from scratch: implement recursive GCD and Fibonacci functions with stopping cases, and recognize when Fibonacci calls repeat work.

Read how Modern C explains recursion →

Modern C, Third Edition

Recursion is a technique in which a computation is defined or performed by calls to the same computation on smaller or simpler inputs.

How it is used
Uses recursive calls to implement mathematical recurrences and parse nested braces while illustrating how active C function calls retain separate state.
How deep it goes
Works through stopping cases, call progress, repeated computation, caching, and failure risks using listings and time recurrences.
Examples
Traces a greatest-common-divisor call, compares three Fibonacci implementations, and uses a brace-indenting recursive-descent parser.
What you can do after
Build it from scratch by choosing a stopping case and progressing inputs, then evaluate repeated work and call-resource risks.

Read how Modern C, Third Edition explains recursion →

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

An algorithm that solves a problem by invoking itself on smaller instances of the same problem.

How it is used
Uses self-calls to express algorithms whose smaller subproblems resemble the original problem.
How deep it goes
Develops base cases, recursive cases, repeated-work memoization, and iterative alternatives through Swift examples rather than formal proofs.
Examples
Demonstrates Fibonacci computation and Towers of Hanoi using recursive Swift functions and stack-backed towers.
What you can do after
Build recursive Swift functions with explicit stopping conditions, recognize repeated work, and substitute memoized or iterative implementations.

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

Grokking Algorithms, Second Edition

Recursion is a problem-solving technique in which a procedure solves a problem by invoking itself on smaller or simpler instances of that problem.

How it is used
Uses self-calling functions to express repeated searches and to build divide-and-conquer solutions.
How deep it goes
Works through stopping cases and call-stack behavior, while deferring tail recursion and a proof of the land-tiling reduction.
Examples
Illustrates self-calls with nested-box searches, countdown, factorial, and square tiling of a rectangular plot.
What you can do after
Build it from scratch with a stopping case and self-call, then assess its stack-memory cost against a loop.

Read how Grokking Algorithms, Second Edition explains recursion →

Grokking Simplicity

A programming technique in which a computation is defined in terms of one or more calls to the same computation.

How it is used
Operates on arbitrarily deep nested data when ordinary array iteration is insufficient.
How deep it goes
Explains base cases, recursive cases, progress toward termination, call-stack behavior, and loops-versus-recursion tradeoffs.
Examples
Uses nestedUpdate() and incrementSizeByName() to modify values at known paths inside nested cart data.
What you can do after
Apply it via nestedUpdate() to modify values at known paths in deeply nested data.

Read how Grokking Simplicity explains recursion →

Elixir in Action, Third Edition

Recursion is a technique in which a computation invokes itself on a smaller, simpler, or continuing input until reaching a terminating or deliberately nonterminating case.

How it is used
Implements looping and long-running server behavior where higher-level iteration abstractions or process abstractions do not hide the mechanism.
How deep it goes
Explains base cases, recursive clauses, list decomposition, tail-call optimization, accumulators, and stack-space behavior.
Examples
Demonstrates factorial, natural-number printing, direct list summation, and accumulator-based tail-recursive summation.
What you can do after
Build it from scratch: write recursive loops with terminating clauses, process lists, and convert suitable functions to tail-recursive form.

Read how Elixir in Action, Third Edition explains recursion →

Learn Haskell by Example

Recursion is a technique in which a computation is defined in terms of applications of itself to smaller or simpler inputs.

How it is used
Replaces loops and mutable counters when traversing lists or repeatedly performing IO actions.
How deep it goes
Works through base cases, list patterns, recursive steps, partial-function failures, and a parameterized IO loop.
Examples
Uses listLength, indexOf, an exercise to implement (!!), and an interactive line-numbering action.
What you can do after
Build it from scratch for list traversal and apply it to simulate a counter-driven IO loop.

Read how Learn Haskell by Example explains recursion →

The Joy of JavaScript

A technique in which a function calls itself directly or indirectly to solve a problem by reducing it to smaller instances.

How it is used
Uses recursion to eliminate iterative state in functional code and traverse nested blockchain objects for validation.
How deep it goes
Explains base cases, carried state, self-calls, and recursive tree traversal, while deferring detailed symbol and iteration treatment.
Examples
Demonstrates recursive hashing over string data and recursive validation across blockchains, blocks, and transactions.
What you can do after
Build it from scratch by converting stateful loops into recursive functions and composing recursive validation across nested objects.

Read how The Joy of JavaScript explains recursion →

Grokking AI Algorithms, Second Edition

A programming technique in which a function or algorithm calls itself until an exit condition is reached.

How it is used
Uses self-calls to explore future game states during Minimax search.
How deep it goes
Traces copied states, terminal checks, depth reduction, and returned scores; stops short of general recursion patterns.
Examples
Demonstrates recursion by exploring Connect Four moves until wins, draws, full boards, or depth limits.
What you can do after
Apply recursion in Minimax search to explore candidate moves and return a best move.

Read how Grokking AI Algorithms, Second Edition explains recursion →

Building User-Friendly DSLs

A computation technique in which a procedure solves a problem by invoking itself on smaller or nested instances of that problem.

How it is used
Uses self-calls to implement generic depth-first traversal and compute properties of abstract syntax trees.
How deep it goes
Explains recursive dispatch, subtree aggregation, and backtracking through returns, without detailing JavaScript engine internals.
Examples
Demonstrates generic AST traversal and counts leaves in a rental AST with numberOfLeaves.
What you can do after
Build it from scratch by writing recursive JavaScript functions that traverse AST objects, references, arrays, and nested values.

Read how Building User-Friendly DSLs explains recursion →

100 Java Mistakes and How to Avoid Them

Recursion is a programming technique in which a method or algorithm invokes itself to solve a problem through smaller subproblems.

How it is used
Uses self-calls to express algorithms over smaller subproblems, especially cleanly for tree traversal.
How deep it goes
Explains stack consumption, JVM-dependent limits, tail-call optimization, iterative rewrites, and cycle risks.
Examples
Uses recursive summation, string index search, and named-node tree search with recursive and iterative implementations.
What you can do after
Diagnose stack-overflow risks, rewrite tail recursion as iteration, and choose heap-based traversal for deeper searches.

Read how 100 Java Mistakes and How to Avoid Them explains recursion →

Julia as a Second Language

Recursion is a programming technique in which a computation invokes itself on smaller or simpler inputs until a terminating condition is reached.

How it is used
Uses factorial and Fibonacci functions to explore repeated computation as an alternative to loops.
How deep it goes
Works through self-calls, stopping cases, a stack overflow, and an iterative comparison without detailing the call stack.
Examples
Uses a failing factorial definition and recursive and iterative Fibonacci implementations motivated by rabbit-population growth.
What you can do after
Build it from scratch: write a terminating Fibonacci function and consider an iterative rewrite when recursion is too slow.

Read how Julia as a Second Language explains recursion →

Practical Automation with PowerShell: Effective scripting from the console to the cloud

Recursion is the repeated traversal or invocation of nested structures through a self-referential operation.

How it is used
Optimizes watcher scripts by limiting searches to relevant nested locations.
How deep it goes
Compares recursive and scoped traversal with runtime evidence, but stops short of implementing recursion itself.
Examples
Uses nested folders and Active Directory site OUs to contrast broad recursive searches with targeted queries.
What you can do after
Apply it via PowerShell by replacing broad recursive searches with targeted commands or separate watchers.

Read how Practical Automation with PowerShell: Effective scripting from the console to the cloud explains recursion →

C++ Concurrency in Action, Second Edition

Recursion is a technique in which a function or process calls itself to solve smaller instances of a problem.

How it is used
Uses recursive task division when data chunks become clear only through processing, as in Quicksort.
How deep it goes
Explains recursive Quicksort calls and concurrency choices, including thread-count risks and alternatives.
Examples
Uses Quicksort partitioning and recursive accumulate reduction to illustrate recursive work division.
What you can do after
Evaluate recursive tasks for concurrent execution by checking data independence and controlling thread creation.

Read how C++ Concurrency in Action, Second Edition explains recursion →

Functional Programming in Scala, Second Edition

Recursion is a technique in which a computation solves a problem by calling itself on smaller or simpler inputs.

How it is used
Expresses loops functionally without mutating a loop variable.
How deep it goes
Explains helper state, base cases, execution traces, tail position, and tail call elimination through factorial.
Examples
Uses factorial, a recursive helper named go, and indented or flat execution traces for factorial(5).
What you can do after
Build recursive Scala loops, trace their evaluation, and recognize when tail recursion prevents stack growth.

Read how Functional Programming in Scala, Second Edition explains recursion →

Clojure: The Essential Reference

Recursion is a computation technique in which a function invokes itself, directly or through other functions, on a successive subproblem or state.

How it is used
Replaces mutation-driven loops with functional iteration that passes successive state through arguments.
How deep it goes
Defines targets, exit conditions, and tail calls, then works through a loop-recur collection example.
Examples
Uses square collection and counter accumulation examples, alongside Java for and do-while contrasts.
What you can do after
Apply it via Clojure loop and recur to build iteration without mutating loop variables.

Read how Clojure: The Essential Reference explains recursion →

Natural Language Processing in Action, Second Edition

Recursion is a computational process in which an operation invokes itself or reuses its output as input until a termination condition is reached.

How it is used
Explains repeated input-output recycling in recursive algorithms, RNNs, and autoregressive transformer generation.
How deep it goes
Defines recursion, distinguishes it from recurrence, and emphasizes termination but stops short of implementing a recursive function.
Examples
Uses recursive token generation, RNN memory, transcription, translation, algorithmic trading, and code generation as examples.
What you can do after
Evaluate recursive NLP architectures and recognize why termination and decreasing work matter for safe repeated computation.

Read how Natural Language Processing in Action, Second Edition explains recursion →

The Well-Grounded Python Developer: How the pros use Python and Flask

Recursion is a technique in which an operation is repeatedly applied to progressively nested or related instances of the same kind of structure.

How it is used
Traverses self-referential comment hierarchies so web applications can display nested content in meaningful order.
How deep it goes
Explains recursive tree traversal and its stopping and return behavior, then connects it to recursive SQL CTEs without detailing the full query.
Examples
Uses a MyBlog content post with nested comment posts represented as a tree.
What you can do after
Apply recursion via SQLAlchemy and recursive CTEs to retrieve hierarchies from self-referential database tables.

Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains recursion →

The Well-Grounded Rubyist, Fourth Edition

Recursion is a programming technique in which a routine invokes itself, directly or indirectly, to solve a problem through progressively smaller or simpler subproblems.

How it is used
Uses self-calling functions to express iteration without side effects, especially in functional programming.
How deep it goes
Explains terminal clauses, argument reduction, and per-call local scope, while deferring a full treatment of recursion.
Examples
Demonstrates recursive method scope, Fibonacci evaluation, pattern-matching Fibonacci, and recursively computed sums of squares.
What you can do after
Apply via Ruby by writing recursive Fibonacci and sum-of-squares functions with explicit terminal clauses.

Read how The Well-Grounded Rubyist, Fourth Edition explains recursion →

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.