if there are n nodes in a binary tree, how many null
pointers are there?

Answers were Sorted based on User's Feedback



if there are n nodes in a binary tree, how many null pointers are there? ..

Answer / anand prakash

If there are n nodes in a Binary Tree then number of null
pointers = n+1

Is This Answer Correct ?    58 Yes 5 No

if there are n nodes in a binary tree, how many null pointers are there? ..

Answer / fakkad

maximum(for complete binary tree) n+1

so total null pointers are <=n+1

It is equivalent to total number of leaf nodes.

Is This Answer Correct ?    8 Yes 3 No

if there are n nodes in a binary tree, how many null pointers are there? ..

Answer / sreenatha

let the binary tree be not symmetric , then it has n-1 edges
excluding the edges from deficient nodes(nodes that have
atmost one child) to NULL.
Suppose , the binary tree was perfectly symmetric (i.e,
every node including the root has exactly two children).
Then , the total no.of edges including the edges from leaf
nodes to NULL would be 2 * N .
So , required ans = 2*N - N-1 = N+1

Is This Answer Correct ?    8 Yes 3 No

if there are n nodes in a binary tree, how many null pointers are there? ..

Answer / banti sharma

Anand Prakash is Absulutely right

Is This Answer Correct ?    6 Yes 5 No

Post New Answer

More Programming Languages AllOther Interview Questions

what will we require to build project with the help of oracle

0 Answers  


i need informatica certification dumps(S-powercenter 8 mapping designer)......plz fwd it to my mail id:gaya1989@yahoo.com

1 Answers  


what is web configuration file

0 Answers   HCL,


I want to pass .pdf files as OlE Object to crystal report through VB6. Please any one guid me...

0 Answers  


how do i add a column dynamically in a table by using java application?

0 Answers  






What is the best action a system can take when deadlock is detected

2 Answers  


i want to open a helkp file that is txt file on link buttons click

1 Answers  


What is a singleton linked list?

1 Answers   Wipro,


Write a program to show polymorphism.

0 Answers   Genpact,


what is difference between scripts, smartforms and adobe forms

5 Answers  


How many types of list exist in the HTML

2 Answers  


what are importance in problem tracking

0 Answers  


Categories