sortUniq

Justin Whear via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 22 14:06:52 PST 2015


On Thu, 22 Jan 2015 13:40:56 -0800, Andrei Alexandrescu wrote:

> There's this classic patter on Unix: |sort|uniq, i.e. sort some data and
> only display the unique elements.
> 
> What would be a better integrated version - one that does sorting and
> uniq in one shot? I suspect the combination could be quite a bit better
> than doing the two in sequence.
> 
> A few google searches didn't yield much. Ideas?
> 
> 
> Thanks,
> 
> Andrei

Efficiency improvement-wise, perhaps a generalization of a counting sort
(http://en.wikipedia.org/wiki/Counting_sort), see "Variant algorithms."


More information about the Digitalmars-d mailing list