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

Function binary_search

src/searching/binary_search.rs:25–38  ·  view source on GitHub ↗

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 search for. - `a

(item: &T, arr: &[T])

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 3

is_asc_arrFunction · 0.70
match_compareFunction · 0.70
lenMethod · 0.45

Tested by

no test coverage detected