Amazon Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: In-Person
What are we searching anyway. Data structure would also depend on what data are we dealing with.
Okay. Let me make my question more clear.
We have some information in the local memory. We need to design a datastructure from which we can retrieve the data based on the instant query made.
I tried to explain using trees and hashmaps. I guess he was expecting a Trie structure.
Okay. Let me make my question more clear.
We have some information in the local memory. We need to design a datastructure from which we can retrieve the data based on the instant query made.
I tried to explain using trees and hashmaps. I guess he was expecting a Trie structure.
might be Trie, but again, we would choose Trie based on the type of data, like if its a phone book directory or something like that. For general approach, I think hash was appropriate ans, We can also use Red Black tree, which are used in databases, which would give us O(lgn) complexity for search, if I am not mistaken..
- Anonymous October 06, 2011