The Runtime Theory
AlgorithmsIn production

Heaps and Priority Queues

Recording in progress
#heaps#priority-queues#data-structures

A binary heap stores a complete tree in a flat array: no pointers, just index arithmetic. This video traces sift-up and sift-down through the array, showing why insert and extract-min stay logarithmic and why heapify builds the whole structure in linear time.

Topics covered:

  • The array layout: a complete tree with no pointers
  • Sift up and sift down: the two primitive operations
  • Insert and extract-min, traced element by element
  • Heapify: building a heap in linear time
  • Heap sort and its cache behavior
  • Real priority queues: schedulers, Dijkstra, and timer wheels

Related articles

More in Algorithms

07:41
algorithms

Hash Tables Under the Hood

Load factors, collision strategies, and cache behavior — why O(1) has a constant that can be 1ns or 200ns.

Watch
In production
algorithms

Tries and String Search

Tries, radix trees, and Aho-Corasick — how prefix structures make lookups proportional to key length, not dataset size.

Details
In production
algorithms

Hash Maps and Collision Resolution

Hash maps from the memory up — hash functions, collision strategies, and the load factor that decides when a map resizes.

Details
In production
algorithms

Graph Algorithms: BFS and DFS

BFS and DFS traced node by node — the queue versus the stack, the visited set, and what each traversal order is good for.

Details
In production
algorithms

Dynamic Programming, Visualized

Memoization and tabulation as data flow — overlapping subproblems, the DP table, and how state transitions map to code.

Details
In production
algorithms

Binary Search Explained

Binary search at the instruction level — midpoint math, cache behavior, and why it beats linear scan on sorted contiguous data.

Details
In production
algorithms

Recursion and the Call Stack

How recursive functions actually execute — stack frames, the base case, and what happens to memory when recursion goes deep.

Details
In production
algorithms

Big-O Notation, Visually Explained

What O(1), O(n), and O(log n) mean as instruction counts — growth curves drawn to scale, constants, and real workloads.

Details
In production
algorithms

Sorting Algorithms Under the Hood

Quicksort, merge sort, and insertion sort compared by the operations that matter: comparisons, swaps, cache misses, and allocations.

Details

Depth, delivered weekly

One technical dispatch a week — articles and episode notes before they go public.

One technical dispatch per week. No noise.