Chapter 39Saving trees in their nodes
The combination of Chapter 29 runs two online BST algorithms in alternating rounds, and every round starts from the same initial tree . At the end of a round, the structure must turn whatever tree the interrupted algorithm left behind back into . A BST cannot keep a second copy of on the side. Demaine, Iacono, Langerman and Özkan (2013) therefore store inside the tree itself, in the bits of data that every node may carry: their tree state buffer (Section 3 of their paper).
- Section 39.1 formalizes the buffer: one data cell per node, indexed by inorder rank, and a finger that walks from cell to cell while another finger rotates the tree. Its headline is the paper’s Lemma 9: an inorder scan interleaved with rotations costs at most .
- Section 39.2 saves a tree into the cells of its own nodes, at twelve bits per node, and restores it from any tree of the same size. Both take linear time: at most to save and to load, the paper’s Lemma 10.
Most of this chapter is proof machinery. The exception is the node and shared-node layers at the end of Section 39.1: the combined policy of Chapter 29 carries a shared tree, so their definitions are on the reading paths of the combination theorems. The note at the start of that section says what a reader needs from them.