Search/Sorts algoruthms : remove live code & console.log, leave examples as comments.

This commit is contained in:
Eric Lavault
2021-10-11 12:29:03 +02:00
parent 8a7be96c9d
commit 74f296578a
22 changed files with 121 additions and 197 deletions

View File

@ -9,7 +9,7 @@
*
*/
function interpolationSearch (arr, key) {
export function interpolationSearch (arr, key) {
const length = arr.length - 1
let low = 0
let high = length
@ -38,9 +38,9 @@ function interpolationSearch (arr, key) {
return -1
}
const arr = [2, 6, 8, 10, 12, 14, 16, 18, 20, 22, 26, 34, 39]
// const arr = [2, 6, 8, 10, 12, 14, 16, 18, 20, 22, 26, 34, 39]
console.log('Found at position :' + interpolationSearch(arr, 2))
console.log('Found at position :' + interpolationSearch(arr, 12))
console.log('Found at position :' + interpolationSearch(arr, 1000))
console.log('Found at position :' + interpolationSearch(arr, 39))
// interpolationSearch(arr, 2)
// interpolationSearch(arr, 12)
// interpolationSearch(arr, 1000)
// interpolationSearch(arr, 39)