Code Refacoring

This commit is contained in:
RitikDua
2020-10-01 21:30:54 +05:30
parent c6a36987c8
commit b4648f7b93

View File

@ -28,9 +28,7 @@ function binarySearchRecursive (arr, x, low = 0, high = arr.length - 1) {
return -1
}
}
function binarySearchIterative (arr, x, low = 0, high = arr.length - 1) {
while (high >= low) {
const mid = Math.floor(low + (high - low) / 2)
@ -51,7 +49,6 @@ function binarySearchIterative (arr, x, low = 0, high = arr.length - 1) {
return -1
}
/* ---------------------------------- Test ---------------------------------- */
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]