sortUniq

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 22 13:47:51 PST 2015


On Thu, Jan 22, 2015 at 01:40:56PM -0800, Andrei Alexandrescu via Digitalmars-d 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?
[...]

Off the top of my head: a sorting algorithm that swallows identical
elements? I've never actually seen such an algorithm before, though.
Generally, sorting algorithms try not to output less elements than they
were given. :-P


T

-- 
Marketing: the art of convincing people to pay for what they didn't need before which you fail to deliver after.


More information about the Digitalmars-d mailing list