Amazon Interview Question for Software Engineer / Developers






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

use tries

- vinaysachdeva23 November 03, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

what to use?

- Anonymous November 03, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

take it easy, just didn`t know this structure

- Anonymous November 03, 2010 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

You will have a class called Entry:
>phone_number: int
>name: string
>details of that person like email, address, alternate number....
>Two child objects of Entry - Entry Left, Entry Right

Then there will be a class called Phonebook
It will have a BST on this structure and use foll functioins:
void insert(Elem elem);
int delete(Elem elem); //return true if elem found and delete
Elem search(String Name);//or number
int update(Elem elem);
void display();

the main adv of storing in BST will be that while displaying alphabetically, u wont need to sort them.

other class can be groups:
to store some groups like friends, relatives, project__1, ...
each of them will have a linked list of the specified Element objects.
Members:
group_name;
List list;
sendToAll();
/* */

- gatorsPK February 15, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Nice!..Thanks!

- zubin.jivani August 14, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Negative. The fan-out factor of using a BST is just 2. Using a TRIE is the only efficient solution, as it would mean less chasing down the pointers.
Fan-out for BST: log2(n)
Fan-out for TRIE: log26(n)
Hence insertion,search as well as deletion is far more optimal in TRIE.

- Ankit Malhotra February 07, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hashtable?

- Rad November 20, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Can use a data structure called Trie.. for more info read wiki link

- Koustubh October 12, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Cant we use trie and hash map. trie for searching and hashmap which uses the name as key for other details.

- satish.timiri October 26, 2016 | 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