No it won't it will just reduce the height of tree to n/2 (from n). My algo- 1. Parse in triplets. For every 3 nodes make the second one parent of other two. Also, queue up such parents. 2. repeat step 1 till you have only 1 node left (root).
But this may give a tree 'imbalanced at root. we may need to do some height re-balancing. -Thanks On Sun, Aug 1, 2010 at 9:26 AM, Manjunath Manohar <[email protected]>wrote: > find the middle of the list and make it as the root..thus i this maner u > will get a balanced tree.. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
