Re: [algogeeks] Re: impossible microsoft puzzle

2010-07-06 Thread Sourashis Roy
u can find the solution to this puzzle here... http://gurmeetsingh.wordpress.com/2009/08/21/puzzle-whats-the-number-on-my-hat/ On Mon, Jul 5, 2010 at 11:03 AM, Nikhil Jindal fundoon...@yahoo.co.inwrote: Again for ur soln, if n is 2 and the numbers are : 2,1 None of them is correct. My

Re: [algogeeks] Re: Merge two BST in O(n) time with O(1)

2010-01-30 Thread Sourashis Roy
Hi , I would like to add to what Shing has suggested. Inorder traverse both trees. This gives two sorted list. Θ(m+n) 2. Merge the two sorted list A, B into a new one C. Θ(m+n) 3. Build a new tree using C. Each node of the tree has just one child. Θ(m+n) Use the LeftChild and RightChild