Package dsa.lab04.solutions
Class BinarySearcher
java.lang.Object
dsa.lab04.solutions.BinarySearcher
Binary search.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescription<Item extends Comparable<Item>>
 intsearch(StaticSequence<Item> items, Item item) Finds the index of the given item in the given sequence using binary search.<Item> intsearch(StaticSequence<Item> items, Comparator<Item> comparator, Item item) Finds the index of the given item in the given sequence using binary search.
- 
Constructor Details- 
BinarySearcherpublic BinarySearcher()
 
- 
- 
Method Details- 
searchFinds the index of the given item in the given sequence using binary search.If the item isn't contained in the sequence, returns -1. The sequence must be sorted for the search to work properly. - Type Parameters:
- Item- the item type
- Parameters:
- items- the sorted sequence
- item- the searched-for item
- Returns:
- the index of iteminitems, or -1 if it's not in it
 
- 
searchFinds the index of the given item in the given sequence using binary search.If the item isn't contained in the sequence, returns -1. The sequence must be sorted for the search to work properly. - Type Parameters:
- Item- the item type
- Parameters:
- items- the sorted sequence
- comparator- the comparator
- item- the searched-for item
- Returns:
- the index of iteminitems, or -1 if it's not in it
 
 
-