4 ms·
One thing of note: if you want sorted order, there's no reason to be using a hash table. It would require either worse than O(n) amortized iteration, or worse
by kadoban 5y ago
One thing of note: if you want sorted order, there's no reason to be using a hash table.
It would require either worse than O(n) amortized iteration, or worse than O(1) expected insertion (A log n has to go somewhere to satisfy the theoretical lower bound for sorting).
If you want sorted, you're going to use a tree based structure.
I'm also not sure how you'd even naturally get sorted order into a hash table. I'm sure it's possible, but on the face of it it just seems bizarre.
- ErikCorry 5y agohttps://news.ycombinator.com/item?id=27704081 https://news.ycombinator.com/item?id=27704081