Design decisions

79. JumpTree: trees grown leaf by leaf (2026-11-21)

  1. std.tree.JumpTree<V> keeps one skew-binary jump pointer per vertex: add(v, p) is O(1); ancestor, lca, lift_while and root_of are O(log n), with Rooted's meanings.
    • Reason: cf2152f builds its trees right to left, each vertex's parent already placed. Building a Rooted for them made the port 2.7x slower than the C++ and use 4x the memory (0.60 s / 64 MB vs 0.22 s / 15 MB). The port's own jump pointers were the right structure, but no other port could reuse them. With JumpTree the port runs in 0.12 s vs 0.11 s for the C++, with identical output.
    • Also: Rooted.ancestor(v, k) returns none for negative k; it used to return a descendant. The new test that checks JumpTree against Rooted found this.
    • Reverse: move the struct back into cf2152f.cp.