public class ArrayBinarySearch<T> extends Object implements ArraySearch<T>
Implement the binary search on array which is assumed to be sorted already
ArrayAlgorithm.Util| Constructor and Description |
|---|
ArrayBinarySearch() |
| Modifier and Type | Method and Description |
|---|---|
Integer |
apply(T[] ts,
Integer from,
Integer to,
T key,
Comparator<T> comp)
Search array region specified by
from and to using the predicate specified |
static void |
main(String[] args) |
public Integer apply(T[] ts, Integer from, Integer to, T key, Comparator<T> comp)
ArraySearchSearch array region specified by from and to using the predicate specified
apply in interface Lang.Func5<T[],Integer,Integer,T,Comparator<T>,Integer>apply in interface ArraySearch<T>ts - the sorted array to be searchedfrom - the from indexto - the to indexkey - the key to search the arraycomp - the comparator functionpublic static void main(String[] args)
Copyright © 2014–2021 OSGL (Open Source General Library). All rights reserved.