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

Method range_query

src/data_structures/fenwick_tree.rs:115–128  ·  view source on GitHub ↗

Computes the sum of elements within a specified range `[left, right]`. This operation calculates the range sum by performing two prefix sum queries. # Arguments `left` - The zero-based starting index of the range. `right` - The zero-based ending index of the range. # Returns A `Result` containing the range sum (`Ok(sum)`) or an error (`FenwickTreeError::InvalidRange`) if the left index is gre

(&self, left: usize, right: usize)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 2

prefix_queryMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected