mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 07:43:04 +08:00
Update src/algorithms/search/exponential-search/exponentialSearch.js
Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>
This commit is contained in:
parent
7c132980ab
commit
fbf12c3259
@ -50,6 +50,6 @@ export default function exponentialSearch(sortedArray, seekElement, comparatorCa
|
|||||||
while (range < length && comparator.lessThanOrEqual(sortedArray[range], seekElement)) {
|
while (range < length && comparator.lessThanOrEqual(sortedArray[range], seekElement)) {
|
||||||
range *= 2;
|
range *= 2;
|
||||||
}
|
}
|
||||||
// Call binary search for the found range.
|
// Call binary search for the found range.
|
||||||
return binarySearch(sortedArray, range/2, Math.min(range, length - 1), seekElement, comparatorCallback);
|
return binarySearch(sortedArray, range/2, Math.min(range, length - 1), seekElement, comparatorCallback);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user