This should be very simple... follow inorder..

Inorder(Node* node, int counter, int N)
{
 if(node == null)return;
 Inorder(node->left, counter, N);
 counter++;
 if(counter == N)
 {
  print(node->data);
  return;
 }
 Inorder(node->right, counter, N);
}


On Wed, Jun 29, 2011 at 9:03 PM, piyush kapoor <[email protected]> wrote:

> Order Statistics Tree
>
>
> On Wed, Jun 29, 2011 at 8:15 PM, sunny agrawal <[email protected]>wrote:
>
>> At each node if we store the Number of nodes in the left subtree.....we
>> can find kth smallest in O(lgn)
>> else do a inorder traversal for k nodes
>>
>> On Wed, Jun 29, 2011 at 8:07 PM, Nishant Mittal <
>> [email protected]> wrote:
>>
>>> how to find kth smallest element in BST...
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Sunny Aggrawal
>> B-Tech IV year,CSI
>> Indian Institute Of Technology,Roorkee
>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> 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.
>

-- 
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.

Reply via email to