Fairly straightforward merge sort for non-mutating and quicksort for mutating/in-place sort.
Non-mutating vector sort is specified to not mutate the return values of previous returns in case of multiple returns, so we do vector->list + merge sort + list->vector instead of copying & in-place sorting.
Quicksort handles repeated elements but is otherwise fairly simplistic (always chooses middle index as the pivot, doesn't use insertion sort).
Fairly straightforward merge sort for non-mutating and quicksort for mutating/in-place sort.
Non-mutating vector sort is specified to not mutate the return values of previous returns in case of multiple returns, so we do
vector->list
+ merge sort +list->vector
instead of copying & in-place sorting.Quicksort handles repeated elements but is otherwise fairly simplistic (always chooses middle index as the pivot, doesn't use insertion sort).