4 ms·
O(n^2) isn't required. One could do an in-place merge-sort, which is also always worst case, but with O(n*log(n)). I suspect everyone turns to Bubblesort since
by ashdnazg 1y ago
O(n^2) isn't required. One could do an in-place merge-sort, which is also always worst case, but with O(n*log(n)).
I suspect everyone turns to Bubblesort since the inputs are small enough that it doesn't matter (evident by the fact that it should fit within microseconds).