Luís Marques:

It would swap elements, like sort, so it doesn't need to put them anywhere, just permute them. The advantage is this:

Input: [7, 3, 7, 1, 1, 1, 1]
Output sort: [1, 1, 1, 1, 3, 7, 7]
Output groupSort: [3, 7, 7, 1, 1, 1, 1]

I think to swap items it must know where to swap them to. And you can't do that efficiently if the groups are unsorted.

Bye,
bearophile

Reply via email to