4 ms·
It might indeed be the best algorithm for common cases of this specific problem, but there needs to be a fallback when either the input is large or a lot of swa
by devit 11y ago
It might indeed be the best algorithm for common cases of this specific problem, but there needs to be a fallback when either the input is large or a lot of swaps are being done since otherwise it's O(n^2).
Interesting that other people pointed this out, yet he apparently committed the code anyway.
- Retric 11y agoInserting a sorted list into another sorted list can be O(n).
- thomasahle 11y agoBut here they want to insert an unsorted list into a sorted list, which must take the same time as sorting.