Exponential Search : Fix 'value' is not defined error .

This commit is contained in:
Eric Lavault
2021-10-11 12:58:45 +02:00
parent 74f296578a
commit 90356f340d

View File

@ -9,12 +9,12 @@
*
*/
function binarySearch (arr, x, floor, ceiling) {
function binarySearch (arr, value, floor, ceiling) {
// Middle index
const mid = Math.floor((floor + ceiling) / 2)
// If value is at the mid position return this position
if (arr[mid] === x) {
if (arr[mid] === value) {
return mid
}