Microsoft Interview Question for Program Managers






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

Delete using postorder traversal... i dont see anything special in this

- Aditya November 04, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In postorder traversal you can go all the way down the tree which can bee n length, that mean it would take o(n) !?

- Ohad.Rahat April 16, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I thougth on this particular problem for about 3 days. There are no solutions for it in the internet.

In short, we need to maintain all the leafs in a doubly-linked list. It can be done not affecting the amortized asymptotic time of other fibonacci-heap operations.
Then we just consequentially delete r elements from this list of leafs, marking the parents the same way we mark them in the procedure 'decrease-key'.
Thus, amortized running time of an operation FIB-HEAP-PRUNE(H, r) is just O(n[H]).

I can't think of a more efficient algorithm not affecting asymptotic running time of other fib-heap operations.

- georgri August 01, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I am studying this question. The problem with your solution is that if we remove a leaf and then try the next one, if its the child of the same parent we need to do a cascading cut which will result in O(rlogn). I though of keeping a link list of size n, which each element i keeps a list of pointers to all nodes with subtree size of i. Then the problem would be to find a combination of numbers that add up to r. Which I don't know how. It will be the sum_subset problem which is np-complete.

- Marzie January 02, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

I mean O(r), of course.

- georgris August 01, 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