[Sort] 정렬 알고리즘
// Time: O(n^2) & Space: O(1) function bubble(arr) { for (let i=0; i= array[j-1] && array[i] < array[j]) { //move number to the right spot array.splice(j,0,array.splice(i,1)[0]); } } } } } } // Time: O(nlogn) & Space: O(n) const numbers = [99, 44, 6, 2, 1, 5, 63, 87, 283, 4, 0]; function mergeSort (array) { if (array.length === 1) { return array } // Split Array into left and right const length ..
2020.06.09