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

Function match_compare

src/searching/binary_search.rs:59–83  ·  view source on GitHub ↗

Compares the item with the middle element of the current search range and updates the search bounds accordingly. This function handles both ascending and descending ordered arrays. It calculates the middle index of the current search range and compares the item with the element at this index. It then updates the search bounds (`left` and `right`) based on the result of this comparison. If the item

(
    item: &T,
    arr: &[T],
    left: &mut usize,
    right: &mut usize,
    is_asc: bool,
)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

binary_searchFunction · 0.70

Calls 1

cmpMethod · 0.45

Tested by

no test coverage detected