First one has a property not that much different from a heapify implementation. I'd ask for more details, though. Is it about re-arranging or set new values on every node? Second, not sure what you mean? Search an element? Third, taking that push(4,10,6), the expected behavior for pop is 10, 6, 4, I'd go for a priority queue.
Sent from my Windows Phone ------------------------------ From: Ashish Goel Sent: Tuesday, April 05, 2011 3:54 AM To: Algorithm Geeks Subject: [algogeeks] MS Questions 1. Given an n-ary tree. requirement it to convert the elements in such a manner that every parent is median of its childs. 2. Given an unsorted array(with negatives and duplicates), search an element with less than 2n comparisions. 3. Modify the push and pop functions of the stack so that the max is extracted out of stack (i would go for max heap) Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.