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() |
public Integer apply(T[] ts, Integer from, Integer to, T key, Comparator<T> comp)
ArraySearch
Search 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–2018 OSGL (Open Source General Library). All rights reserved.