mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
Exponential Search : Fix 'value' is not defined
error .
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user