Sorting Algorithms (bubble sort, merge sort)
What is the significance of the base case condition (arr.length <= 1) in this merge sort implementation?
function mergeSort(arr) {
if (arr.length <= 1) return arr;
const mid = Math.floor(arr.length / 2);
const left = mergeSort(arr.slice(0, mid));
const right = mergeSort(arr.slice(mid));
return merge(left, right);
}