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.)
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.)