mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
Search/Sorts algoruthms : remove live code & console.log, leave examples as comments.
This commit is contained in:
@ -47,12 +47,8 @@ function exponentialSearch (arr, length, value) {
|
||||
return binarySearch(arr, value, i / 2, Math.min(i, length))
|
||||
}
|
||||
|
||||
const arr = [2, 3, 4, 10, 40, 65, 78, 100]
|
||||
const value = 78
|
||||
const result = exponentialSearch(arr, arr.length, value)
|
||||
export { binarySearch, exponentialSearch}
|
||||
|
||||
if (result < 0) {
|
||||
console.log('Element not found')
|
||||
} else {
|
||||
console.log('Element found at position :' + result)
|
||||
}
|
||||
// const arr = [2, 3, 4, 10, 40, 65, 78, 100]
|
||||
// const value = 78
|
||||
// const result = exponentialSearch(arr, arr.length, value)
|
||||
|
Reference in New Issue
Block a user