3 ms·
How?
by roel_v 8y ago
How?
- saagarjha 8y agoIt requires a single linear pass instead of a convoluted sort.
- roel_v 8y ago... what sort? Are talking about the same thing here?
- saagarjha 8y agoThe code in the article has a sort in it.
- KirinDave 8y agoWhy would that be "more copies" than building up a hash table is what I don't get.
- bjoli 8y agoIt 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.
- bjoli 8y agoIt requires a single pass through the array, whereas the article suggests different approaches that all go through the array multiple times (or even O(n^2)). For small lists this is probably ok, but for big lists it is a very slow approach. Edit: I would probably use a bloom filter for this.