AlgoFrames

Library

Every topic, by Part and Chapter.

Foundations

How computers represent data, how programs run, and how to reason about cost.

Linear Data Structures

Arrays, strings, linked lists, stacks, queues and hash tables: the building blocks every other structure uses.

  • Arrays and strings: Contiguous storage: indexing, shifting, growing arrays, matrices and strings.
  • Linked lists: Nodes joined by pointers: singly, doubly and circular lists and the classic list techniques.
  • Stacks and queues: Last-in-first-out and first-in-first-out structures and the problems they solve.
  • Hashing: Turn keys into array positions for near-constant-time lookup, and handle collisions.

Recursion

Functions that call themselves: base cases, the call stack, recursion trees and when to turn recursion into a loop.

  • Recursion: Functions that call themselves: base cases, the call stack, recursion trees and when to turn recursion into a loop.

Searching and Sorting

Finding values quickly and putting data in order, from linear search to merge sort, quick sort and radix sort.

  • Searching: Find a value by scanning, or by halving a sorted range again and again.
  • Elementary sorting: Simple quadratic sorts that show how comparisons and swaps put data in order.
  • Efficient sorting: Sorts that reach n log n or better, how to compare them and how real libraries sort.

Trees and Heaps

Hierarchical structures: binary trees, search trees, heaps, tries and union-find.

  • Trees: Tree vocabulary, binary trees, traversal orders and recursive tree problems.
  • Binary search trees: Ordered trees that keep search fast, and the rotations that keep them balanced.
  • Heaps and priority queues: Trees stored in arrays that always hand you the smallest or largest item.
  • Tries and union-find: Prefix trees for words and disjoint sets for grouping connected items.

Graphs

Vertices and edges: traversal, shortest paths, spanning trees, connectivity and network flow.

  • Basics: Graph vocabulary, ways to store a graph, and graphs hidden inside grids and puzzles.
  • Traversal: Visit every vertex with BFS and DFS, then find components, cycles and orderings.
  • Shortest paths: Fewest edges or least total weight: BFS, Dijkstra, Bellman-Ford, Floyd-Warshall and A*.
  • Spanning trees and connectivity: Connect everything at minimum cost, and find the parts a graph cannot lose.
  • Flow and matching: Push as much as possible through a network, and pair items up with matchings.

Problem-Solving Techniques

Reusable ways to attack a problem: two pointers, sliding windows, backtracking, greedy choices and divide and conquer.

Dynamic Programming

Solve each subproblem once and reuse the answer: memoization, tables, knapsack, string DP and more.

  • Dynamic Programming: Solve each subproblem once and reuse the answer: memoization, tables, knapsack, string DP and more.

Advanced Data Structures

Specialised structures for fast queries: caches, segment trees, Fenwick trees, Bloom filters and B-trees.

  • Advanced Data Structures: Specialised structures for fast queries: caches, segment trees, Fenwick trees, Bloom filters and B-trees.

Computer Systems

How hardware and the operating system run programs: CPUs, caches, processes, scheduling, locks and memory.

  • Operating systems: Processes, scheduling, concurrency, deadlock, virtual memory and garbage collection.

Languages, Compilers and Theory of Computation

How code becomes a running program, and what computers can and cannot compute.