3 ms·
Actually for small values of n, an n^2 sort can be quicker than an nlogn sort, depending on how it is implemented.
by cgoddard 16y ago
Actually for small values of n, an n^2 sort can be quicker than an nlogn sort, depending on how it is implemented.
- Jach 16y agoYeah, hence insertion sort (the best n^2 sorter) is used to speed up quick-sort. It's insane to think of using bubble sort for the same task. (And for n=2, you don't need a sorting algorithm.)