You are viewing a single comment's thread. Return to all comments →
Thanks, that helped a lot. Here's my Javascript implementation of that gif lol =P
function insertionSort2 (n, arr) { let storage for (let i = 1; i < n; i++) { storage = arr.splice(i, 1)[0] for (let j = i; j >= 0; j--) { if (storage > arr[j-1] || j === 0) { arr.splice(j, 0, storage) break } } console.log(arr.join(' ')) } }
Insertion Sort - Part 2
You are viewing a single comment's thread. Return to all comments →
Thanks, that helped a lot. Here's my Javascript implementation of that gif lol =P