I hereby claim:
- I am elitenomad on github.
- I am elitenomad (https://keybase.io/elitenomad) on keybase.
- I have a public key whose fingerprint is 6803 769F 8D8B 79CF F5AE 46F2 5FDA 3049 AFF8 B453
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| const bubble_sort = (array) => { | |
| for(let i = 0 ; i < array.length - 1 ; i++) { | |
| for(let j = 0; j < array.length - i - 1; j++){ | |
| if(array[j] > array[j + 1]){ | |
| const temp = array[j]; | |
| array[j] = array[j+1]; | |
| array[j+1] = temp; | |
| } | |
| } | |
| } |
| const binary_search = (list, item) => { | |
| let min = 0; | |
| let max = list.length - 1; | |
| let middle_index = Math.floor((min + max)/2); | |
| while(min <= max){ | |
| if(list[middle_index] == item) { | |
| return list[middle_index]; | |
| } |
| const factorialRecursiveWithMemoization = (n) => { | |
| const multiplyer = (ender) => { | |
| if(ender == 1){ | |
| return ender; | |
| }else{ | |
| return (ender * multiplyer(ender - 1)) | |
| } | |
| } | |
| return multiplyer(n); |
| const factorialWithRecursive = (n) => { | |
| if(n == 1){ | |
| return n; | |
| }else{ | |
| return (n * factorialWithRecursive(n - 1)); | |
| } | |
| } | |
| const factorialRecursive = factorialWithRecursive(5); | |
| console.log(`What is factorialRecursive ${factorialRecursive}`); |
| const joinElements = (array, joiner) => { | |
| const recurse = (index, resultSoFor = '') => { | |
| resultSoFor += array[index]; | |
| if (index == array.length - 1) { | |
| return resultSoFor; | |
| } else { | |
| resultSoFor = resultSoFor + joiner; | |
| return recurse(index + 1, resultSoFor); | |
| } |