Fixed InterpolationSearch getting caught on missing element.
This commit is contained in:
parent
b97fb17561
commit
abb7b04383
@ -53,6 +53,12 @@ public class InterpolationSearch {
|
||||
this.divisions++;
|
||||
} else {
|
||||
probe = high;
|
||||
if (array[probe] != key) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (array[high] < key || array[low] > key) {
|
||||
break;
|
||||
}
|
||||
/* Checks if the key is less than the probe's value */
|
||||
if (array[probe] > key) {
|
||||
|
Loading…
Reference in New Issue
Block a user