Dis'd do :-D int klargest_recur(int k,List* head) { if(!head || !k) return -1; int rsize = 0; if(head->right) rsize = size(head->right); if(k == rsize + 1) return head->data; if(k <= rsize) return klargest_recur(k, head->right); else return klargest_recur(k - rsize - 1, head->left); }
On Mon, Jun 14, 2010 at 8:34 AM, Lekha <lek...@gmail.com> wrote: > Inorder traversal till u reach the kth element(If it is sorted in > descending order, otherwise go till (n-k)th element).. > > > On Sun, Jun 13, 2010 at 9:24 PM, Rohit Saraf > <rohit.kumar.sa...@gmail.com>wrote: > >> Repeated q. Search in the group >> >> -- >> -------------------------------------------------- >> Rohit Saraf >> Second Year Undergraduate, >> Dept. of Computer Science and Engineering >> IIT Bombay >> http://www.cse.iitb.ac.in/~rohitfeb14<http://www.cse.iitb.ac.in/%7Erohitfeb14> >> >> -- >> 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. >> >> > > > -- > Lekha > > -- > 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. > -- Simplicity is prerequisite for reliability. – Edsger W. Dijkstra -- 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.