Luís Marques:
I was thinking, we don't even need the full power of sort. Is there a standard algorithm that makes elements with equal keys be in sequence, but that otherwise is less expensive than sort?
I don't know any, how is it supposed to know where to group items? Usually you build an associative array for that.
Bye, bearophile