Sorts an array on keys after copying it, returning the copy.
This will precompute the keys of all items up front, which may make it more
efficient than using sorted with comparing, which will call
the key function 2n log n times.
This internally creates a copy of the input array twice, using 2n extra
space, i.e. the Schwartzian transform.
Sorts an array on keys after copying it, returning the copy.
This will precompute the keys of all items up front, which may make it more efficient than using sorted with comparing, which will call the key function 2n log n times.
This internally creates a copy of the input array twice, using 2n extra space, i.e. the Schwartzian transform.