|
345 | 345 | function recursiveBinarySearch(array, value, leftposition, rightposition) { |
346 | 346 |
|
347 | 347 | // Value DNE |
348 | | - if (left > right) return -1; |
| 348 | + if (leftposition > rightposition) return -1; |
349 | 349 |
|
350 | 350 | var middle_pivot = Math.floor((leftposition + rightposition) / 2); |
351 | 351 | if (array[middle_pivot] === value) { |
352 | 352 | return middle_pivot; |
353 | | - } else if (array[middle_pivot] > key) { |
| 353 | + } else if (array[middle_pivot] > value) { |
354 | 354 | return recursiveBinarySearch(array, value, leftposition, middle_pivot - 1); |
355 | 355 | } else { |
356 | 356 | return recursiveBinarySearch(array, value, middle_pivot + 1, rightposition); |
|
0 commit comments