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

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I HAVE DONE TESTING TOOLS COURSE,NOW I AM FRESHER,I AM NOT GETTING ANY CALLS,I WANT TO DO THE PROJECT ,WHERE I HAVE TO MEET TO DO THE PROJECT,I AM GOING WITH FAKE EXPERIENCE,SO WHAT I HAVE TO DO.

4309


smal talk is pure object oriented or not?

1529


how can i split string in a textbox in windows appication using C#.net

2214


i want to insert textbox value to sql db. i have only one text box but store four values. ple give any one give sample code in asp.net c#..

2890


19. Given a system that is described with the following equation, X=A+(B.(A̅+C)+C)+A.B.(D̅+E̅) a) Simplify the equation using Boolean Algebra. b) Implement the original and then the simplified equation with a digital circuit. c) Implement the original and then the simplified equation in ladder logic.

1252






In JCl , we have COND parameter.This holds comparison code and condition.It also has only and even parameters. ex: COND((4,GE),EVEN).what the comma mean here. is that 'and' or 'or'.

1820


Which design patterns have you used?

1556


how to hide prompts

1465


Given: coordinates of rectangle-> left bottom and right top points. the rectangles create a hole.Find the maximum area of the hole. eg. 4 rectangles create a hole in between. find its area.

1981


what is the BAM? where we can use it in BizTalk server?

1358


is it acceptable if we declare multiple exceptions in same overridden method.

2115


which worker is involved in all the phases of SDLC?

1712


HOW TO FIND NUMBER OF TWOS IN N!(N FACTORIAL)??

1789


Explain three modes in which files can be accessed from python program

1327


what is meant by life cycle of a business

1701