Though i couldn't get both ur approaches clearly , guess 2nd approach shud
take O(n^2)  since you go to each node and find the size of left subtree .

Or i shud be missing something. my bad can you explain your approaches
clearly.

On Wed, Dec 9, 2009 at 8:20 PM, Rohit Saraf <rohit.kumar.sa...@gmail.com>wrote:

> do it iteratively either by:
>
> 1) If size of left tree is less than k, rotate the tree left. and so on
> till .....single while loop required for this.
> or
> 2) Start from head, if k is more than size of left-tree, go to left and
> continue searching.. other wise go right and search for k-size(left)-1 in
> right tree. All this can be implemented in a single while loop.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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.


Reply via email to