Madan, yours will take O(n) space.
I could think of an algo which takes O(nlogn) time and O(logn) space.
We first traverse till the middle of the original BST and make it the
root. We also make the till now traversed portion of the tree to be the
right child of this root and then we recursively solve the problem.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to