[algogeeks] Re: Trees
5 is possible. Considering root of the tree to be at level 0, level 1 and level 2 are completely filled. There are 5 internal nodes in level 1, (since all level 2 nodes are present) Now only (10 - 5(from level 1)+1(the root)) nodes are required. So choose 4 nodes from level 2 and make them interior node. So you get 4*5(4 nodes have 5 children) + (5*5(There are 5*5 nodes in level 2)-4(These became leaves)) leaves. Unfortunately 5 is not in the option On Aug 11, 7:31 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 is the value of n. a. 3 b. 6 c. 4 How to solve such problems?? -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Trees
I tried solving this problem and came to conclusion that none of the options can be correct. Indeed for value 5, you can have a solution. Then i googled for this question, and found out that, you have an option missing. i.e 5 :| On Aug 11, 9:01 pm, rajeev bharshetty rajeevr...@gmail.com wrote: @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 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 is the value of n. a. 3 b. 6 c. 4 How to solve such problems?? -- 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 algogeeks+unsubscr...@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 algogeeks@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. -- Regards Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Trees
@amit: Thanks On Thu, Aug 11, 2011 at 10:04 PM, amit karmakar amit.codenam...@gmail.comwrote: I tried solving this problem and came to conclusion that none of the options can be correct. Indeed for value 5, you can have a solution. Then i googled for this question, and found out that, you have an option missing. i.e 5 :| On Aug 11, 9:01 pm, rajeev bharshetty rajeevr...@gmail.com wrote: @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 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 is the value of n. a. 3b. 6 c. 4 How to solve such problems?? -- 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 algogeeks+unsubscr...@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 algogeeks@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. -- Regards Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Trees
* correction (5*5(There are 5*5 nodes in level 2)-4(These became internal nodes..)) On Aug 11, 9:58 pm, amit karmakar amit.codenam...@gmail.com wrote: 5 is possible. Considering root of the tree to be at level 0, level 1 and level 2 are completely filled. There are 5 internal nodes in level 1, (since all level 2 nodes are present) Now only (10 - 5(from level 1)+1(the root)) nodes are required. So choose 4 nodes from level 2 and make them interior node. So you get 4*5(4 nodes have 5 children) + (5*5(There are 5*5 nodes in level 2)-4(These became leaves)) leaves. Unfortunately 5 is not in the option On Aug 11, 7:31 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 is the value of n. a. 3 b. 6 c. 4 How to solve such problems?? -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Trees
Answer is 5. the relation is No of leaf nodes = (n-1)*(no of internal nodes) + 1 Paul On Thu, Aug 11, 2011 at 10:44 PM, amit karmakar amit.codenam...@gmail.comwrote: * correction (5*5(There are 5*5 nodes in level 2)-4(These became internal nodes..)) On Aug 11, 9:58 pm, amit karmakar amit.codenam...@gmail.com wrote: 5 is possible. Considering root of the tree to be at level 0, level 1 and level 2 are completely filled. There are 5 internal nodes in level 1, (since all level 2 nodes are present) Now only (10 - 5(from level 1)+1(the root)) nodes are required. So choose 4 nodes from level 2 and make them interior node. So you get 4*5(4 nodes have 5 children) + (5*5(There are 5*5 nodes in level 2)-4(These became leaves)) leaves. Unfortunately 5 is not in the option On Aug 11, 7:31 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 is the value of n. a. 3b. 6 c. 4 How to solve such problems?? -- 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 algogeeks+unsubscr...@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 algogeeks@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.
Re: [algogeeks] Re: Trees
How is this formula obtained? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/zBQSNmP4ITQJ. To post to this group, send email to algogeeks@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.
Re: [algogeeks] Re: Trees
I am also getting , 5 as answer now. here is what I did. In any n-ary tree we can add one internal node by adding n-children to any one of its leaf nodes. This operation creates one internal node and at the cost one leaf node and adds n new leaf nodes. L(i) be leaf nodes in a tree with i internal nodes, then L(i+1) = L(i) + n - 1 L(0) = 1 , since tree with root node has 0 internal nodes and one leave node L(i) = L(0) + i*(n-1) or L(i) = i*(n-1) + 1 On Thu, Aug 11, 2011 at 11:34 PM, Raman raman.u...@gmail.com wrote: How is this formula obtained? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/zBQSNmP4ITQJ. To post to this group, send email to algogeeks@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. -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.