public class IterativeBinarySearch<T extends java.lang.Comparable> extends java.lang.Object implements Search<T>
ARRAY_IS_EMPTY, DATA_TYPE_NOT_SUPPORTED_YET, DECIMAL_RADIX, DELIMITER_COMMA, ELEMENT_NOT_FOUND, LIST_IS_EMPTY, OPERATION_NOT_SUPPORTED_YET
Constructor and Description |
---|
IterativeBinarySearch() |
Modifier and Type | Method and Description |
---|---|
int |
findIndex(T[] sortedInput,
T targetElement)
Since we reduce the search space by half each time, the complexity must be in the order of O(log(n)). O(log(n)) time and O(1) space. |
protected int |
findIndexIteratively(T[] sortedInput,
T itemToSearch,
int start,
int end) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkArray, checkIntArray, checkList