BinarySearch
object BinarySearch
class Object
trait Matchable
class Any
Type members
Classlikes
Value members
Concrete methods
Binary search using a custom compare function.
Binary search using a custom compare function.
scala.util.Searching does not support the ability to search an IndexedSeq by a custom mapping function, you must search by an element of the same type as the elements of the Seq.
- Value Params
- array
Must be sorted according to compare function so that for all i > j, compare(array(i), array(i)) == Greater.
- compare
Callback used at every guess index to determine whether the search element has been found, or whether to search above or below the guess index.
- Returns
The first element where compare(element) == Equal. There is no guarantee which element is chosen if many elements return Equal.