| |
GeekInterview.com > Interview Questions > Concepts > Data Structures
| Print | |
Question: Data Structure for one million named objects
Answer: If you have one million named objects and you want to store them in a data structure that lets you insert new objects quickly and search for an object by name quickly, what data structure should you use? |
| April 04, 2009 05:54:12 |
#4 |
| katrin.shechtman |
Member Since: April 2009 Total Comments: 1 |
RE: Data Structure for one million named objects |
I think the most suitable here will be a dictionary solution - the
tree where each node contains a letter. And each name will be a word
in such a dictionary, so we need the node also contains the sign that
there is a name ends here (let's say -|). For example:
N | M | ...
I | O I | ...
K-| | L K-| | ...
| L | ...
| Y-| | ...
|
| |
Back To Question | |