Skip to main content

null_runs_for_alg

Function null_runs_for_alg 

Source
pub fn null_runs_for_alg(
    eps: &[(u64, u64)],
    tree_size: u64,
    arity: u64,
) -> Vec<NullRun>
Expand description

Decompose algorithm eps’s inactive positions in [0, tree_size) into the canonical null collapse runs: the maximal aligned k-ary blocks the tree folds to null, greatest-block-first within each contiguous inactive span (the same greedy decomposition spine::frontier_for_size applies to the whole tree, here applied to each inactive gap).

This is the committed activation in geometric form. It is a canonical function of the active intervals eps and (tree_size, arity): the union of the returned block spans is exactly the inactive position set, so the active set — and therefore eps in canonical form — is recoverable as the complement. Committing these runs commits the identical activity the epoch intervals carry.

The inactive set is computed interval-wise — the complement of the active epochs, derived by merging them and taking the gaps within [0, tree_size) — not by scanning each position. Cost is O(#epochs · log #epochs) plus the per-gap block decomposition, so the fully-active canonical form [(0, MAX)] early-outs to an empty vector and the binding root folds in O(log n).