News for hackers. Stuff that matters.
Re:Google Interview University – Plan for studying to become... by rb808 on Thursday October 06, 2016 @12:44PM (#12653909)
> Java's HashMap.get() was not 0(1) and asked if I was taught that in my non-Stanford education. (It is btw, feel free to analyze the implementation)

It is O(1) if the hashmap is sparsely populated but if there are hash collisions the items are stored in a list (tree from 8) so is not O(1) in worst case

Re:Google Interview University – Plan for studying to become... by dragonwriter on Thursday October 06, 2016 @12:59PM (#12654032)
> It is O(1) if the hashmap is sparsely populated

With a finite number of buckets (which is inherent to hashmap), asymptotic performance will never conform to the "sparsely populated" constraint, so its O(n).

(That its concrete performance is roughly constant-time within certain size bounds in non-pathological cases is important knowledge, too, though.)