Re: [algogeeks] Re: gcd sum function

2010-01-30 Thread abhijith reddy
Yes i have .. and i have the worst time in the rank page :) On Fri, Jan 29, 2010 at 8:51 PM, fundoonick fundoon...@yahoo.co.in wrote: I tried this problem using the method of solving using eulerphi values. I calculate values of eulerphi in O(nlogn) and then use them to calculate gcdsum using

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

2010-01-30 Thread saurabh gupta
or a balanced BST can be made in step 3, in linear time too, if one objects to the skew model. 2010/1/29 ShingRay masterrays...@gmail.com Oh, I have said something wrong. 1. Inorder traverse both trees. This gives two sorted list. Θ(m+n) 2. Merge the two sorted list A, B into a new one C.

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