Bloomberg LP Interview Question
Financial Software DevelopersCountry: United States
Interview Type: Phone Interview
how a hash table mapping name (key) to phone number (value) will provide O(1) lookup?
looking for key (name) in hashmap will itself take O(n) time?
If efficiency is determined in terms of time complexity of insertion/deletion/search, a hash table mapping name (key) to phone number (value) will provide O(1) lookup, addition and deletion, should be most efficient.
- Sharma February 13, 2012This will hold true, unless the number of name-phone number entries are exorbitantly large, leading to hash collisions.