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)