Part IModels
Part I fixes what a binary search tree execution is and what it costs. The literature uses several models for this, each convenient for some arguments, and the book uses all of them. This introduction lists them and shows how they relate. Every model is defined in its own chapter, and Chapter 12 proves the main correspondences. The last chapter, on real-world implementations, charges what the BST models leave free: the time spent choosing the BST operations, and the memory used for it.
The models
| Chapters | Model | An execution is | Cost |
|---|---|---|---|
| 1–3 | Rotations | A sequence of root accesses on a tree whose keys are its inorder ranks, changed by rotations. Each request rotates anywhere until the requested key is at the root. | : one per request, one per rotation |
| 4 | Labelled trees | The same, on trees that store arbitrary ordered keys | |
| 5 | Online algorithms | A rule that chooses each access from the requests so far. Its run is an execution of the rotation model. | |
| 6 | Insertions and deletions | A sequence of accesses, insertions and deletions by rank, with balance data in the nodes. Data edits are counted separately. | one per node of the search path, one per rotation |
| 7 | Pointer machine | One cursor, which starts at the root for every request, moves along edges and rotates its node over its parent | : one per request, one per instruction |
| 8 | Touched regions | Each request touches a rooted subtree containing the requested key, and rearranges it | the number of touched nodes |
| 9 | Geometric view | An arborally satisfied set of points (key, time) containing the requests | : the number of points |
| 10 | Many fingers | Several persistent fingers in one tree, each moving or rotating at its node | one per request, one per instruction |
| 11 | Linked searches | Static searches in a store of many trees joined by links, with a count of memory words. Not a BST. | one per visited node and per followed link |
| 13 | Real-world machines | A finite program with word registers and a fixed number of words per node, which moves and rotates one persistent finger and receives one request at a time | running time: one per instruction; BST cost: one per move or rotation |
The rotation model is the library’s basic one: “a legal BST algorithm” and “the offline optimum” in later theorems refer to it, unless a theorem says otherwise. The pointer machine is the standard model of the literature. Touched regions and the geometric view describe an execution by the keys it touches, which is what lower bounds and the geometric algorithms work with. The dictionary model of Chapter 6 adds updates, for the classical trees of Part III, and charges searches instead of forcing the requested key to the root. Two models serve particular results. Many fingers describe a static tree searched with a lazy finger (Chapter 15) and the multi-finger BSTs of the combination (Chapter 29). Linked searches are the model of the multiple-tree structure (Chapter 28), and are compared with nothing else. Real-world machines move one persistent finger, like a one-finger BST, but with bounded state and charged computation, and they compile to the general pointer machine of Tarjan (1979).
How the models relate
An arrow in the figure means that an execution in one model gives an execution in the other that serves the same requests, at the cost written on the arrow. The arrows between the rotation model, the pointer machine and the geometric view lose only constant factors, plus a term in when the initial tree is prescribed. So the offline optimum is the same in all three, up to constant factors. The bottom row does the same for online algorithms.
The table lists every correspondence, with requests, keys, rotations, pointer cost (requests plus instructions), points and steps of a real-world machine.
| From | To | Cost | Trees | Theorem |
|---|---|---|---|---|
| rotation execution | dictionary execution of the same accesses | main cost | same final tree | of_execution |
| shape executions | labelled executions | equal, both ways | same up to labels | execution_on_keys_iff |
| pointer execution | rotation execution | final rotations away | to_rotations |
|
| rotation execution | pointer execution | same final tree | to_pointer |
|
| rotation execution | pointer execution | final rotations away | to_pointer_lazy |
|
| online rotation algorithm | online pointer algorithm | any initial tree | simulation |
|
| one-finger lazy-finger execution | pointer execution | same tree | same_tree |
|
| region execution | point set | equal, both ways | initial tree chosen | ass_iff_region_execution |
| rotation execution | point set | initial forgotten | rotations_to_ass |
|
| pointer execution | point set | initial forgotten | pointers_to_ass |
|
| point set | pointer execution | initial chosen | ass_to_pointers |
|
| point set | rotation execution | initial prescribed | ass_to_rotations |
|
| point set | pointer execution | initial prescribed | ass_to_pointers_from |
|
| online geometric algorithm | online BST algorithm | any initial tree | online_bst |
|
| real-world machine run | single-cursor trace from the same finger | BST cost | same final tree | physical |
| real-world machine execution | compiled run on Tarjan’s pointer machine | instructions | same final tree, as records; related initial state given, word width | execution |
Two consequences shape the rest of the book. Bounds can be stated in whichever model is most convenient and moved to the others at a constant cost: Part II states its sequence bounds for rotation-model algorithms, and Wilber’s lower bound in Chapter 17 is proved on point sets. And an algorithm can be designed in whichever model is most convenient: splaying (Section 24.1) is a rotation algorithm, GreedyASS (Section 25.1) is a geometric one, and Tango (Section 26.2) maintains a tree whose edges are marked by preferred paths.