Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the maximum total number of nodes in a tree that has
N levels? Note that the root is level (zero)

Answers were Sorted based on User's Feedback



What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / salmiya thilsath.a

2^(N+1)-1..

if N=0; it is 2-1=1,1 is the max no of node in the tree
if N=1; it is 4-1=3, 3 is the max no of nodes in the tree
if N=2; it is 8-1=7, 7 is the max

and it goes like that...........

Is This Answer Correct ?    124 Yes 8 No

What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / asharani k p

(2 pow n)-1,if root level is one and (2 pow n+1)-1, if root
level is zero.

Is This Answer Correct ?    26 Yes 11 No

What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / gaurav gupta

(2^(N+1))-1
Suppose level is 2 then total number of nodes will be
1 root
2 left of root and right of root
2 left and right of left of root
2 left and right of right of root
so total nodes are 1+2+2+2=7

by formula (2^(2+1))-1
8-1=7

Is This Answer Correct ?    24 Yes 10 No

What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / deba

2^(N+1)-1

Is This Answer Correct ?    21 Yes 9 No

What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / gopala krishnan

2^N -1

Is This Answer Correct ?    15 Yes 10 No

What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / bipin from utkal university mc

if tree is binary tree then maximum no.of node is 2^(N+1)-1

Is This Answer Correct ?    5 Yes 0 No

What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / hex

to be more generic this kind of problem is best solved
recursivly.

To point out that 2 ^ N AND 3 ^ N are both wrong,
here's a few examples: (the exponet is the amount of levels)
2^0 = 1, correct
2^1 = 2, incorrect, should be 3
2^2 = 4, incorrect, should be 7

And a tree with three children
3^0 = 1, correct
3^1 = 3, incorrect, should be 4
3^2 = 9, incorrect, should be 13

Looking at that I'm sure you can see the pattern.
Let
C = "Number of Possible Children"
N = Levels

N
&#931; C^N
j=0

or in C++ code
int NodeCount(int C, int N)
{
if (N < 0) return 0
return NodeCount(C, N-1) + C^N
}

Is This Answer Correct ?    8 Yes 4 No

What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / vaishali naidu

If root is at level 0 then :
Case 0:
When level is 1 max nodes is 1
Case 1:
When level is 1 then max would be 3.
Case 2:
When level is 2 then max nodes would be 7

So formula would be 2^(n+1) -1

2^(0+1)-1=1
2^(1+1)-1=3
2^(2+1)-1=7

Is This Answer Correct ?    6 Yes 3 No

What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / s. sadagopan

Infinite

In a tree a node can have any number of nodes independent
of the levels.

Is This Answer Correct ?    8 Yes 6 No

What is the maximum total number of nodes in a tree that has N levels? Note that the root is level ..

Answer / saurabh

2^(N+1)-1

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Data Structures Interview Questions

List the types of tree.

0 Answers  


What is the type of the algorithm used in solving the 8 Queens problem?

1 Answers  


How to copy an array into another array?

0 Answers  


How do you sort an arraylist?

0 Answers  


1) Program A and B are analyzed and found to have worst- case running times no greater than 150nlog2n and n2 respectively.Answer the folloWing questions if possible.. i) which program has the better guarantee on the running time,for larger values of n(n>10000) ? ii) which program has the better guarantee on the running time,for small values of n(n<100) ? iii) which program will run faster on average for n =1000 2) wRite a program to compute the number of collisions required in a long random sequence of insertions using linear probing ,quadratic probing and double hashing 3) what is the optimal way to compute A1 A2 A3 A4 A5 A6 where the dimensions of the matrices are A1:10*20 A2 : 20 * 1 A3 : 1 * 40 A4 : 40*5 A5 : 5 * 30 A6 : 30 X 15

5 Answers   KPIT,


How to search binary in a sorted array?

0 Answers  


What is the best case time complexity of bubble sort?

0 Answers  


How do you define a set?

0 Answers  


Which type of sorting is best?

0 Answers  


What is b tree in data structure?

0 Answers  


What should I learn first data structures or algorithms?

0 Answers  


Which file contains the definition of member functions?

0 Answers  


Categories