|
|
|
|
|
by infogulch
3712 days ago
|
|
It's possible to make one implementation for a type that supports multiple orderings, at the cost of another indirection [0]. This turns O(N*M) implementations for N types and M sorting orders into just O(N). (I'm not counting an inline anonymous function as a new implementation.) In practice, it's rare to need to sort a slice more than one way. [0]: https://gist.github.com/infogulch/5db15e5ae5cf073f1088033ba4... |
|