Rebuild the tree into a balanced structure and clear the dirty flag. Leaf-preserving and
partial: unchanged internal subtrees graft in whole (indices untouched); only changed internals
are recycled. O(m log m) in the changed unit count m, not the body count.
Rebuild the tree into a balanced structure and clear the dirty flag. Leaf-preserving and partial: unchanged internal subtrees graft in whole (indices untouched); only changed internals are recycled. O(m log m) in the changed unit count m, not the body count.