Skip to content
AITroveRead. Build. Understand.

Trees and Heaps

Hierarchical search and priority order.

Hierarchical search and priority order. Work through the operation contract, runnable case, and cost before selecting the structure for a real workload.

Lessons

Practice and next steps

AVL trees: restore height balance after insertion

Skip lists: randomized levels over an ordered bottom chain

B+ leaf pages: split full pages and keep range order

Red-black trees: audit color and black-height invariants

B-trees: split full pages during ordered insertion

Interval trees: prune overlap search with subtree maximums

Compressed tries: split shared edge labels at the divergence

Red-black insertion: rotate and recolor an ordered index

B+ trees: propagate leaf splits through multiple levels

Balanced interval indexes: rotate height and maximum metadata together

Compressed tries: delete exact keys and merge unused edges

B+ deletion: borrow, merge, and repair separators

Indexed binary heaps: decrease a queued priority

Red-black deletion: move color before removing a key

AVL interval deletion: repair balance and maximum endpoints

Page journals: replay committed index changes

Persistent ordered indexes: copy search paths, share subtrees

Framed journals: detect a torn tail before replay

Failure-linked tries: find overlapping alert terms in one scan

Suffix arrays: indexed substring search and adjacent LCP

K-d trees: exact nearest depot with plane pruning

Binary-tree traversals: four orders without recursion

AVL order statistics: maintain subtree sizes for rank and select

Wavelet tree: subarray counts and order statistics

Implicit treap: edit positions and reverse a range

Heavy-light decomposition: sum weights along a tree path

Binary lifting: ancestors and common managers

Suffix automata: index substrings as text arrives

Packed R-tree: search intersecting depot rectangles

Binary tries: choose a maximum-XOR fingerprint

Merkle trees: verify an indexed scan record

Two heaps: maintain an exact running median

Expiry heaps: invalidate stale TTL records on replacement

D-ary heaps: trade shallower ascent for wider extraction

Pairing heaps: meld roots and pair children on removal

Binomial heaps: carry equal-degree trees during merge

Radix heaps: queue nondecreasing integer priorities

Double-ended queues: reconcile min and max heaps

Point-region quadtrees: subdivide crowded cells

Bounding-volume hierarchies: prune box overlap searches

Morton ordering: decompose a grid window into code ranges

Ropes: share text chunks across immutable revisions

Level-order unary degree tries: encode child runs as bits

Buddy blocks: split powers of two and reunite partners

Ternary search trees: branch by character and continue prefixes

Binary radix routing: choose the longest matching prefix

Splay Trees: Access Rotations and Join Invariants

Cartesian trees: preserve sequence order under a heap minimum

Leftist heaps: keep the right spine short for meld

Two-dimensional range trees: count a static rectangle

Van Emde Boas trees: successor in a bounded integer universe

Scapegoat trees: rebuild a deep insertion subtree

Palindromic trees: index distinct palindromes as text arrives

Balanced-parentheses trees: encode an ordered hierarchy

BK-trees: search incident labels within edit distance

Vantage-point trees: nearest depots by a metric radius

FM-index backward search: narrow a suffix interval by character

Euler-tour RMQ: answer static common ancestors in constant query time

X-fast trie: predecessor and successor in a fixed integer universe

Compressed suffix trees: locate patterns across a frozen text

Skew heaps: meld priorities by swapping child paths

Fibonacci heaps: cut on decrease and consolidate on removal

Tournament trees: merge sorted runs through one winner path

Priority search trees: report events in a three-sided region

Reduced ordered decision diagrams: share identical rule branches

LZ78 phrase tries: emit dictionary index and next symbol

Huffman trees: assign prefix codes from symbol frequencies

Ordered treaps: split, join, and select depot keys

Span skip lists: rank and select without a full scan

Zero-suppressed diagrams: share sparse dispatch set families

Double-array tries: static incident-code transitions with BASE and CHECK

Adaptive radix trees: grow byte-edge nodes as incident codes branch

Minimal acyclic dictionaries: merge equivalent word suffix states

Min-max heaps: remove either end of one dispatch priority array

Patricia binary routing: compress chains without losing prefix matches

Sliding medians: expire heap entries by event identity

Ball trees: prune exact nearest-depot search with radius bounds

Curriculum

Hierarchical search and priority order.

  1. 1Binary search trees: preserve order through every branch
  2. 2Binary heaps: select the next priority with a tie rule
  3. 3Tries: make prefix search distinct from complete-key lookup
  4. 4AVL trees: restore height balance after insertion
  5. 5Skip lists: randomized levels over an ordered bottom chain
  6. 6B+ leaf pages: split full pages and keep range order
  7. 7Red-black trees: audit color and black-height invariants
  8. 8B-trees: split full pages during ordered insertion
  9. 9Interval trees: prune overlap search with subtree maximums
  10. 10Compressed tries: split shared edge labels at the divergence
  11. 11Red-black insertion: rotate and recolor an ordered index
  12. 12B+ trees: propagate leaf splits through multiple levels
  13. 13Balanced interval indexes: rotate height and maximum metadata together
  14. 14Compressed tries: delete exact keys and merge unused edges
  15. 15B+ deletion: borrow, merge, and repair separators
  16. 16Indexed binary heaps: decrease a queued priority
  17. 17Red-black deletion: move color before removing a key
  18. 18AVL interval deletion: repair balance and maximum endpoints
  19. 19Page journals: replay committed index changes
  20. 20Persistent ordered indexes: copy search paths, share subtrees
  21. 21Framed journals: detect a torn tail before replay
  22. 22Failure-linked tries: find overlapping alert terms in one scan
  23. 23Suffix arrays: indexed substring search and adjacent LCP
  24. 24K-d trees: exact nearest depot with plane pruning
  25. 25Binary-tree traversals: four orders without recursion
  26. 26AVL order statistics: maintain subtree sizes for rank and select
  27. 27Wavelet tree: subarray counts and order statistics
  28. 28Implicit treap: edit positions and reverse a range
  29. 29Heavy-light decomposition: sum weights along a tree path
  30. 30Binary lifting: ancestors and common managers
  31. 31Suffix automata: index substrings as text arrives
  32. 32Packed R-tree: search intersecting depot rectangles
  33. 33Binary tries: choose a maximum-XOR fingerprint
  34. 34Merkle trees: verify an indexed scan record
  35. 35Two heaps: maintain an exact running median
  36. 36Expiry heaps: invalidate stale TTL records on replacement
  37. 37D-ary heaps: trade shallower ascent for wider extraction
  38. 38Pairing heaps: meld roots and pair children on removal
  39. 39Binomial heaps: carry equal-degree trees during merge
  40. 40Radix heaps: queue nondecreasing integer priorities
  41. 41Double-ended queues: reconcile min and max heaps
  42. 42Point-region quadtrees: subdivide crowded cells
  43. 43Bounding-volume hierarchies: prune box overlap searches
  44. 44Morton ordering: decompose a grid window into code ranges
  45. 45Ropes: share text chunks across immutable revisions
  46. 46Level-order unary degree tries: encode child runs as bits
  47. 47Buddy blocks: split powers of two and reunite partners
  48. 48Ternary search trees: branch by character and continue prefixes
  49. 49Binary radix routing: choose the longest matching prefix
  50. 50Splay Trees: Access Rotations and Join Invariants
  51. 51Cartesian trees: preserve sequence order under a heap minimum
  52. 52Leftist heaps: keep the right spine short for meld
  53. 53Two-dimensional range trees: count a static rectangle
  54. 54Van Emde Boas trees: successor in a bounded integer universe
  55. 55Scapegoat trees: rebuild a deep insertion subtree
  56. 56Palindromic trees: index distinct palindromes as text arrives
  57. 57Balanced-parentheses trees: encode an ordered hierarchy
  58. 58BK-trees: search incident labels within edit distance
  59. 59Vantage-point trees: nearest depots by a metric radius
  60. 60FM-index backward search: narrow a suffix interval by character
  61. 61Euler-tour RMQ: answer static common ancestors in constant query time
  62. 62X-fast trie: predecessor and successor in a fixed integer universe
  63. 63Compressed suffix trees: locate patterns across a frozen text
  64. 64Skew heaps: meld priorities by swapping child paths
  65. 65Fibonacci heaps: cut on decrease and consolidate on removal
  66. 66Tournament trees: merge sorted runs through one winner path
  67. 67Priority search trees: report events in a three-sided region
  68. 68Reduced ordered decision diagrams: share identical rule branches
  69. 69LZ78 phrase tries: emit dictionary index and next symbol
  70. 70Huffman trees: assign prefix codes from symbol frequencies
  71. 71Ordered treaps: split, join, and select depot keys
  72. 72Span skip lists: rank and select without a full scan
  73. 73Zero-suppressed diagrams: share sparse dispatch set families
  74. 74Double-array tries: static incident-code transitions with BASE and CHECK
  75. 75Adaptive radix trees: grow byte-edge nodes as incident codes branch
  76. 76Minimal acyclic dictionaries: merge equivalent word suffix states
  77. 77Min-max heaps: remove either end of one dispatch priority array
  78. 78Patricia binary routing: compress chains without losing prefix matches
  79. 79Sliding medians: expire heap entries by event identity
  80. 80Ball trees: prune exact nearest-depot search with radius bounds
Storage details