Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
 Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE

 Categories >> Software >> Operating Systems >> Data Structures

 Windows Interview Questions (339) Linux Interview Questions (449) Unix Interview Questions (455) Solaris Interview Questions (781) RTOS Interview Questions (43) Bulnex Interview Questions (4) Operating Systems General Concepts Interview Questions (261) Data Structures Interview Questions (66) Operating Systems AllOther Interview Questions (47)
Question
```What is the maximum total number of nodes in a tree that has
N levels? Note that the root is level (zero)```
Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 1
(n)2-1
 Is This Answer Correct ? 11 Yes 34 No
Srikanth

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 2
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 ? 97 Yes 5 No
Salmiya Thilsath.a

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 3
2powN-1
 Is This Answer Correct ? 9 Yes 19 No
Pavan

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 4
(2 pow n)-1,if root level is one and (2 pow n+1)-1, if root
level is zero.

 Is This Answer Correct ? 23 Yes 9 No
Asharani K P

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 5
(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 ? 21 Yes 8 No
Gaurav Gupta

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 6
2^(N+1)-1
 Is This Answer Correct ? 16 Yes 6 No
Deba

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 7
if the tree is binary tree [i.e two children max]then
if it has 3 max children then
3pow(N)
...............................
if it has n max children then
npow(N)

 Is This Answer Correct ? 4 Yes 7 No
M.eshwar

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 8
2^N-1
 Is This Answer Correct ? 2 Yes 14 No
Prachi

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 9
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 ? 7 Yes 4 No
Hex

Re: What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
# 10
2^N -1
 Is This Answer Correct ? 12 Yes 6 No
Gopala Krishnan

  Question Asked @ Answers Other Data Structures Interview Questions applications of linked lists and mostly used linked list? 3 sir plz. send me a bunch of questions related to this topic which may help me in campus selection ABC 1 How can one find a cycle in the linked list? IF found how to recognize the cycle and delete that cycle? Citrix 12 When will you sort an array of pointers to list elements, rather than sorting the elements themselves? 5 Which one is faster? A binary search of an orderd set of elements in an array or a sequential search of the elements. Syntel 22 Parenthesis are never needed in prefix or postfix expressions. Why? Microsoft 11 The element being searched for is not found in an array of 100 elements. What is the average number of comparisons needed in a sequential search to determine that the element is not there, if the elements are completely unordered? Morgan-Stanley 11 What is binary tree? BMC 13 how to find the number of possible tree in the given tree. Wipro 12 What is the average number of comparisons needed in a sequential search to determine the position of an element in an array of 100 elements, if the elements are ordered from largest to smallest? ABB 18 wt is a datastructure CybAge 8 applications of stacks and their uses? Samsung 1 For more Data Structures Interview Questions Click Here