Hacker News new | ask | show | jobs
by dclara 4533 days ago
Regarding the speed vs memory occupation, there should be comparison between linkedlist vs. hashmap. I remember that linkedlist is faster. So it depends on the language support.

You can google it more. I don't have time to find out about the Big O footprint for both now. Here is one link discussing about it:

http://stackoverflow.com/questions/7975802/when-to-use-hashm...

2 comments

Linear lists are.... linear. Hash maps are constant access. N doesn't need to get very large to see orders of magnitude difference—one you'll certainly see if you switch on level0.
A linked list is not faster than a hash in looking up an element. The operation is O(N) for a linked list and O(1) for a hash.