Mutates your slice to sort. Don't want it sorted? Clone it yourself!
Doesn't actually verify if successful, since by <=>= rules this can never fail. This enables us to return an iterator with confidence instead of having to collect.
And integer division means that with odd length input the right "half" (greater numbers) will be longer, so we can start with greater numbers as per rules.
Rust
Mutates your slice to sort. Don't want it sorted? Clone it yourself!
Doesn't actually verify if successful, since by
<=
>=
rules this can never fail. This enables us to return an iterator with confidence instead of having to collect.And integer division means that with odd length input the right "half" (greater numbers) will be longer, so we can start with greater numbers as per rules.
Look at it go!