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
fbf12c3259
commit
820492a8a8
@ -45,7 +45,7 @@ export default function exponentialSearch(sortedArray, seekElement, comparatorCa
|
|||||||
if (comparator.equal(sortedArray[0], seekElement))
|
if (comparator.equal(sortedArray[0], seekElement))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Find range for binary search by repeated doubling
|
// Find range for binary search by repeated doubling
|
||||||
let range = 1;
|
let range = 1;
|
||||||
while (range < length && comparator.lessThanOrEqual(sortedArray[range], seekElement)) {
|
while (range < length && comparator.lessThanOrEqual(sortedArray[range], seekElement)) {
|
||||||
range *= 2;
|
range *= 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user