MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / prefix_query

Method prefix_query

src/data_structures/fenwick_tree.rs:87–100  ·  view source on GitHub ↗

Computes the sum of elements from the start of the tree up to a specified index. This operation efficiently calculates the prefix sum using the tree structure. # Arguments `index` - The zero-based index up to which the sum should be computed. # Returns A `Result` containing the prefix sum (`Ok(sum)`) or an error (`FenwickTreeError::IndexOutOfBounds`) if the index is out of bounds.

(&self, index: usize)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 2

range_queryMethod · 0.80
point_queryMethod · 0.80

Calls 2

lowbitFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected