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 are other resources are needed for this mantis?

0 Answers  


Suppose we are doing 4 operations on database using service, first operation is successful but due to some reason remaining 3 operations are failed. I) is this transaction successful or not? ii) How can you give that error message to user?

0 Answers  


why rownum=1 works properly but not rownum=>2,=>3 etc.

0 Answers   Oracle,


Write a shell program to test whether a given year is leap year or not ?

0 Answers   Patni,


DIFFERENCE BETWEEN BINDING LANG AND BIND DIR WHEN USING IN SERVICE PGM

0 Answers   CTS,






what is posix?

1 Answers   HCL,


in a company 30% are supervisors and 40% employees are male if 60% of supervisors are male. what is the probability that a randomly choosen employee is a male or female?need steps to solve this?

1 Answers   TCS,


Can i please VHDL code for D-Latch with clear input ?? (HINT: Set up a “Process” with appropriate sensitivity list to get the desired D-Latch with Clr working.) Inputs and Outputs: entity Lab4b is Port ( Clr, Clk, D : in STD_LOGIC; Q : out STD_LOGIC); end Lab4b;

0 Answers  


How to display questions one by one in jsp and I wants to store the answers in my database?

0 Answers  


What function would you use to extract characters from a given string?

2 Answers  


swap two number wthout using third variable

4 Answers   eClerx,


Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number

0 Answers   Amazon,


Categories