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

Method from_vec

src/data_structures/segment_tree.rs:47–62  ·  view source on GitHub ↗

Creates a new `SegmentTree` from the provided slice of elements. # Arguments `arr`: A slice of elements of type `T` to initialize the segment tree. `merge`: A merging function that defines how to merge two elements of type `T`. # Returns A new `SegmentTree` instance populated with the given elements.

(arr: &[T], merge: F)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 2

mergeFunction · 0.70
lenMethod · 0.45

Tested by

no test coverage detected