Facebook

  www.facebook.com
Work in HR? Unlock Free Profile

Facebook Software Engineer Intern Interview Question

"How would you store and search 1 million names?"
Add Tags [?]
Answer

Part of a Software Engineer Intern Interview Review - one of 1,089 Facebook Interview Reviews

Answers & Comments

1
of 1
vote

(Something like this — it's been too long for me to remember the exact questions.)

Start by asking about assumptions: should it be stored in-memory, what matters most: search performance or compact storage, etc.

- Interview Candidate on Apr 19, 2012
0
of 1
vote

I guess in this case 'Tries' will be a good structure.. For large data, where lookup will be needed it is better data-structure.
But, I guess you must ask what is the usage scenario :)

- Anonymous on Apr 22, 2012
0
of 0
votes

How about B-Tree or Hashtable if space is not an issue?

- Anon on May 6, 2012
0
of 0
votes

Tries are good if it can fit into the memory.
Else we can do some preprocessing like sorting the names in persistent storage.
And have the multi level indexing in the main memory.

- AB on May 27, 2012

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.