Microsoft Interview Question for Software Engineer / Developers






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

1. Do external sort using key as first node_id of each entry.
2. Search for a given node_id in the file for which sub graph needs to be made.
3. node_id.level = 0. Enque node_id.
4. Repeat 5-8 if Queue is not empty else end.
5. node_id = Dequeue()
6. Read all the entries for second node_id corresponding to node_id (dequeued).
7. For each entries
node_id_xx.level = node_id.level + 1
Enque node_id_xx and at the same time delete it from file (so that if cycle exist we wont enque again).
8. Go to 5.

- Tulley February 10, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Yea, this is BFS and should work.

- Anonymous February 13, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Are there loops in the nodes?

- Jonas March 12, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Most efficient Algorithm

Read all entries from file.
Create a hash table and for each entry read from the file, hash it based on the start node_id
Add the cost,dest node_id to the hash table.

Now each entry of hash table is a linked list. So Adding in the above step means add to the linked list.

- gavinashg March 26, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Dude.. data is too huge to be kept in hash in main memory...

- Anonymous March 13, 2012 | Flag


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