compute_combination_indices

Function compute_combination_indices 

Source
pub fn compute_combination_indices(
    k: usize,
    i: usize,
) -> Option<CombinationIndices>
Expand description

Calculates the layer and indices for the i-th combining operation in a complete binary tree with 2^k leaves.

§Arguments

  • k - The power defining the number of leaves (2^k). Assumed constant for the tree structure.
  • i - The zero-based, overall index of the combining operation (0 <= i < 2^k - 1).

§Returns

An Option<CombinationIndices> containing the location of the operation, or None if i is out of bounds.