Binary Search Trees in Lean Check a result Declarations Bibliography Lean source

Part VStructures

Part V holds the data structures that the algorithms and proofs of the book are built from. None of them is a BST algorithm in its own right. Each is a way of storing something inside a binary search tree, or next to it, with a stated cost. Most of them appear only inside proofs. Where a chapter or section is not needed to check any headline result, a note at its start says so and says what it is for.

Chapter Structure What it provides Used by
32 Treaps Point sets executed as BSTs, and BSTs recorded as point sets, at exactly one node per point; random treaps for given weights Chapter 12, Chapter 15
33 Split trees Groups of keys that can be split off a few at a time, paid for by the smaller side Section 25.2
34 Prefix sums and weighted search trees Rectangle sums in four reads; static trees with entropy depth Chapter 27, Chapter 28
35 Simulating fingers BST deques, tendons and finger hands: several fingers simulated by the single root cursor Chapter 16, Chapter 29
36 Replays, mirrors and detours Pointer computations as data: recorded and replayed instruction streams, detours, mirror images, depths along a computation, fields in the nodes Chapter 29, Chapter 30, Chapter 31, and the three chapters after it
37 Pop-tarts BSTs that implement a stack of weighted leaves, with constant amortized and logarithmic worst-case cost, and weight-balanced depth Chapter 38
38 Heavy paths A source tree stored along its heavy paths, so that every key keeps weight-balanced depth while a finger moves and rotates Chapter 30
39 Saving trees in their nodes Tree buffers and snapshots: a tree saved into its own nodes and restored in linear time Chapter 29

The first three chapters serve the results of Part I, Part II and Part IV: the equivalence of the geometric view with BST executions, the online simulation behind GreedyASS, and the two static structures built from a request sequence. The last five serve the transformations at the end of Part IV. The deamortization of Chapter 30 keeps the tree of its source algorithm at logarithmic depth with pop-tarts along heavy paths. The combination of Chapter 29 runs two algorithms on one tree with two fingers, simulated by one, and restores the initial tree between rounds from a copy saved in the nodes. Chapter 36 collects the tools that both use to treat pointer computations as data.