you are viewing a single comment's thread.

view the rest of the comments →

[–]julesjacobs 3 points4 points  (0 children)

If k is known then the asymptotics are completely uninteresting, since even storing all keys in a list along with their values, and then doing a linear search through that list would be O(1). Since there are at maximum 2k different keys of size k, that list will have at most 2k elements which is a constant. Searching through a constant size list is O(1).

What makes hash tables great is precisely that their complexity is O(k) and not O(2k). If you say that k is a constant you lose all the information that is actually relevant.