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

Function build_heap

src/sorting/heap_sort.rs:13–20  ·  view source on GitHub ↗

Builds a heap from the provided array. This function builds either a max heap or a min heap based on the `is_max_heap` parameter. # Arguments `arr` - A mutable reference to the array to be sorted. `is_max_heap` - A boolean indicating whether to build a max heap (`true`) or a min heap (`false`).

(arr: &mut [T], is_max_heap: bool)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

heap_sortFunction · 0.85

Calls 2

heapifyFunction · 0.70
lenMethod · 0.45

Tested by

no test coverage detected