@Sagar

See at level 4, 81 leaf  nodes are possible, since in question it has been
given 28 leaf  nodes, if i  use just 10 nodes from level 3 (27 nodes), i can
get 28 leaves, but if u observe the remaining 17 nodes in the 3rd level are
also becoming leaf nodes, but in question given as 28 leaf nodes..Plz
correct me.

What i feel is we can have 2 cases

1) Minimum internal nodes posible

If we can observe nodes pattern in each level

1
3
9
27

so in 4th level there are 27 leaf nodes, to get 28 leaf nodes, select one
from 27 nodes and add 2 childs, so total leaf nodes become (27-1)+2=28
In this case, internal nodes= 1+3+9+1=14

2) maximum internal nodes

in the 4th level, add one child to each node, we get 27 leaf nodes in 5th
level  and similarly select 1nodes  in 5th level and add 2 childs to make
nodes 28, now we have interal nodes= 1+3+9+27+1=41

Correct me if wrong...

On 10 August 2011 05:19, sagar pareek <sagarpar...@gmail.com> wrote:

> Excatly....
>
> why dont u just make a rough diagram in paper for binary and ternary trees
>
> and just see that each level has max of 2/3^i   where 2/3 is for
> binary/ternary tree and i is level where root level is 0...
>
> then make a complete ternary tree and see why leaves with 28 in numbers
> have internal nodes 40...
> just do it and then u will learn
>
>
> On Wed, Aug 10, 2011 at 4:58 PM, Brijesh Upadhyay <
> brijeshupadhyay...@gmail.com> wrote:
>
>> It could have a maximum of 81 leaves with the same '40' no of internal
>> nodes.... so for any value between 28 to 81, it would have only 40 internal
>> nodes
>>
>> --
>> 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/-/hb7mifIIe1kJ.
>>
>> 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
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT ALLAHABAD
>
>  --
> 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.
>



-- 
With Regards,
N.Vamshi Vijay,
Mtech,CSE
IIT Kharagpur
Mobile:-07501541110

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

Reply via email to