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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does a bubble chart show?

461


Explain how to find 3rd element from end in a linked list in one pass?

490


What is doubly linked list in data structure?

435


How do you use merge sort?

443


How do you sort a list in reverse order?

475






What is the minimum number of queues needed when implementing a priority queue?

543


Why do we need searching algorithms?

615


What do you mean by balance factor of a node in avl tree?

576


Differentiate between queue and deque.

512


Is list a data type?

500


What is a multiset table?

439


Which is better stack or queue?

457


What are control structures?

536


What are the advantages of modularity?

507


What is hash value of a string?

475