Function treap_map::accumulate_weight_search
source · pub fn accumulate_weight_search<C, W, F, E>(
root: &Node<C>,
f: F,
extract: E
) -> SearchResult<'_, C, W>where
C: TreapMapConfig,
F: FnMut(&W, &Node<C>) -> SearchDirection<W>,
W: ConsoliableWeight,
E: Fn(&C::Weight) -> &W,
Expand description
Performs a binary search in a treap-map.
This function conducts a binary search within a treap-map structure, where at each step it can access the accumulated weight from the leftmost node to the current node.
§Parameters
node
: The root node of the treap-map.f
: A search function that takes the accumulated weight from the leftmost node to the current node (excluding the current node) and the current node itself. It returns a search direction (seeSearchDirection
struct for more details).extract
: A function to extract a subset of the weight stored in the treap-map. This allows for avoiding the reading and maintenance of fields that are not needed during the search.