You are viewing a single comment's thread. Return to all comments →
Javascript solution;
for (let i = 1; i < n; i++) { for (let j = 0; j < i; j++) { if (arr[j] > arr[i]) { const temp = arr[j]; arr[j] = arr[i]; arr[i] = temp; } } process.stdout.write(arr.join(' ') + '\n'); }
Seems like cookies are disabled on this browser, please enable them to open this website
Insertion Sort - Part 2
You are viewing a single comment's thread. Return to all comments →
Javascript solution;