79. JumpTree: trees grown leaf by leaf (2026-11-21)
std.tree.JumpTree<V>keeps one skew-binary jump pointer per vertex:add(v, p)is O(1);ancestor,lca,lift_whileandroot_ofare O(log n), withRooted's meanings.- Reason: cf2152f builds its trees right to left, each vertex's parent already placed. Building a
Rootedfor 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. WithJumpTreethe port runs in 0.12 s vs 0.11 s for the C++, with identical output. - Also:
Rooted.ancestor(v, k)returnsnonefor negativek; it used to return a descendant. The new test that checksJumpTreeagainstRootedfound this. - Reverse: move the struct back into
cf2152f.cp.
- Reason: cf2152f builds its trees right to left, each vertex's parent already placed. Building a