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

Function binary_search_rec

src/searching/binary_search_recursive.rs:23–41  ·  view source on GitHub ↗

Recursively performs a binary search for a specified item within a sorted array. This function can handle both ascending and descending ordered arrays. It takes a reference to the item to search for and a slice of the array. If the item is found, it returns the index of the item within the array. If the item is not found, it returns `None`. # Parameters - `item`: A reference to the item to sear

(item: &T, arr: &[T], 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

lenMethod · 0.45
cmpMethod · 0.45

Tested by

no test coverage detected