Re: [algogeeks] Trees

2011-08-11 Thread Nitin Nizhawan
i guess answer is c. 4 n*i+1 On Thu, Aug 11, 2011 at 8:01 PM, rShetty rajeevr...@gmail.com wrote: A complete n- array tree in which each node has n children or no children, let i be the number of internal nodes and L be the number of leaves in a complete n- array tree. If L=41 and i=10 what

Re: [algogeeks] Trees

2011-08-11 Thread rajeev bharshetty
@all : Could anyone explain it using the tree diagram . @nithin : 4 may not be th answer i am not able to plot into a tree satisfying those constarints On Thu, Aug 11, 2011 at 9:16 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: i guess answer is c. 4 n*i+1 On Thu, Aug 11, 2011 at 8:01

[algogeeks] TREES

2011-07-21 Thread Piyush Sinha
*A preorder of a complete binary tree is given in an array , prints its level order * -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] TREES

2011-07-21 Thread SkRiPt KiDdIe
vectorint v[HMAX]; Fill(ar,0,n-1,0);//main() call void Fill(int ar[],int start,int end,int idx) { if(startend)return; v[idx].push_back(ar[start]); Fill(ar,start+1,(end+start)/2,idx+1); Fill(ar,(end+start)/2+1,end,idx+1); } ar[] is input array/ v contains

[algogeeks] trees

2010-06-16 Thread divya
Given a Parent -Child binary tree ,build the child -sibling version of it? Minimize the space requirements wherever possible. -- 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

Re: [algogeeks] trees

2010-06-16 Thread Anurag Sharma
Do a level order traversal, like in BFS, and make the child sibling tree accordingly Anurag Sharma On Wed, Jun 16, 2010 at 11:59 PM, divya sweetdivya@gmail.com wrote: Given a Parent -Child binary tree ,build the child -sibling version of it? Minimize the space requirements wherever

Re: [algogeeks] trees

2010-06-15 Thread Anand
Here is an implementation for BST and search an element in BST in O(logn ) time On Sun, Jun 13, 2010 at 8:04 PM, 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

Re: [algogeeks] trees

2010-06-15 Thread sharad kumar
On Mon, Jun 14, 2010 at 8:35 AM, sharad kumar sharad20073...@gmail.comwrote: @rohit..i m not able to find this ques in this group so plzz help -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] trees

2010-06-15 Thread divya jain
reverse in order traversal till u reach kth node. reverse inorder means first visit right child then print data nd then left. On 14 June 2010 08:34, 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

Re: [algogeeks] trees

2010-06-15 Thread sharad kumar
@rohit..i m not able to find this ques in this g -- 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

Re: [algogeeks] trees

2010-06-15 Thread sharad kumar
@lekha u dont noe total elements in bst...for finding that 1 more traversal is required...can it be done in 1 pass only -- 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

Re: [algogeeks] trees

2010-06-15 Thread Anand
http://codepad.org/ricAcQtu On Sun, Jun 13, 2010 at 9:13 PM, Anand anandut2...@gmail.com wrote: Here is an implementation for BST and search an element in BST in O(logn ) time On Sun, Jun 13, 2010 at 8:04 PM, Lekha lek...@gmail.com wrote: Inorder traversal till u reach the kth element(If

Re: [algogeeks] trees

2010-06-15 Thread vadivel selvaraj
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,

[algogeeks] trees

2010-06-13 Thread sharad
find k th largest element in bst(inplace) -- 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

Re: [algogeeks] trees

2010-06-13 Thread Rohit Saraf
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 -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] trees

2010-06-13 Thread Lekha
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.comwrote: Repeated q. Search in the group -- --