Re:Removing Array Duplicates
by saagarjha on Friday April 12, 2019 @04:13AM
(#19642987)
It requires a single linear pass instead of a convoluted sort.
[ Parent
| on HN ]
... what sort? Are talking about the same thing here?
The code in the article has a sort in it.
Why would that be "more copies" than building up a hash table is what I don't get.
It requires many passes through the list, and even O(LogN) is probably enough to make it slower than a hash based O(n) approach depending on list size. Hashing is fast. If space is an issue, just use an appropriately sized bloom filter.