|
|
|
|
|
by bakhy
2626 days ago
|
|
This is what I'd do too, and it is quite strange that it was dismissed like that. Maybe because it's not as much fun :) BTW I believe it may be a bit more than just O(n) time on the whole. If your hash-table is auto-growing, you'll have to pay for its resizing. And OTOH if it's sized up front, then you'll have to allocate something proportional to the size of the full array, not just to the number of distinct elements. |
|