I quite intentionally did not say one would be always be "faster". I said reverse sort is less efficient. sort and reverse sort are both O(n log n), but the one with reverse has a larger constant factor and is less efficient.
By the way, if you want to know the fastest way to sort the list (1..100_000) in descending order, it's:
reverse (1 .. 100_000);
;)
Update: Doh. As Tilly explains below, I totally messed up the Big O analysis. Anyway, there is an added inefficiency with reverse sort, that's my point. :) | [reply] [d/l] |
| [reply] |