public class IntBinarySearch
extends java.lang.Object
Constructor and Description |
---|
IntBinarySearch() |
Modifier and Type | Method and Description |
---|---|
static int |
binarySearch(org.magicwerk.brownies.collections.primitive.IIntList list,
int key,
int lower,
int upper)
Searches the specified list for the specified object using the binary search algorithm.
|
public static int binarySearch(org.magicwerk.brownies.collections.primitive.IIntList list, int key, int lower, int upper)
Collections.sort(List, Comparator)
method), prior
to making this call. If it is not sorted, the results are undefined.
This method runs in log(n) time on random-access lists, which offer near-constant-time access to each list element.
list
- the list to be searched.key
- the value to be searched for.lower
- lower bound of range to searchupper
- upper bound of range to search