Skip to main content

midpoint_rank

Function midpoint_rank 

Source
fn midpoint_rank(existing_ranks: &[Option<i64>], pos: usize) -> Option<i64>
Expand description

Computes the rank to assign to a new book being inserted at position pos in a list of existing ranks (which may be None for books whose ranks have not yet been computed).

Returns None when the gap between the two neighbours has been fully exhausted (they differ by ≤ 1), signalling that a full recompute is needed.