Amazon Interview Question


Country: India




Comment hidden because of low score. Click to expand.
0
of 0 vote

I think the whole stucture is based on map reduce. Hash table is the very basic concept of it.

- ric February 20, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

By "Window search", did you take the meaning to be the search feature that searches your files on Windows? I'm somehow skeptical that something like that would use map reduce.

- eugene.yarovoi February 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Assuming you are saying "window search" to be say the Windows Search feature of Windows7.

The best would be to use suffix tree (or trie) to implement such a functionality.

Initially, index all the files in the suffix tree with the leaf node value being the location of the file on the disk.

When the user searches, list all the files with the prefixes as entered by the user.

- ashu February 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think ashu is Right.......(but space complexity is high in case of suffix tree)

- saurabh February 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

If you wanted to list based on prefixes, you pretty much need a prefix tree. A hash table won't really work. Another possibility is just a sorted array, of course, if the files are re-indexed relatively infrequently. I'd probably opt for a prefix tree.

- eugene.yarovoi February 25, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

For removing space complexity we could go to a certain level with trie then we could use simple binary search.
Ternary search tree is also a good example of having trie like functionality with lower space ..

- ahmad March 03, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

The best approach would be to build indexes on contents and filename

- viv March 16, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

What a stupid question. Any reasonable sized product/feature will use multiple data-structures.

- Anonymous February 21, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More