I think C) is the correct answer

The Gateway to Computer Science Excellence

+1 vote

A. Total no. of trees that were there in the forest.

B. Total no. of nodes in the forest.

C. Total no. of nodes which have only right child.

D. Return max element among all nodes.

0

C should be wrong answer.

But in the question, if they mentioned " it is arbitrary tree represented by right child pointers ", then option A is correct.

I hope this question from ACE.

But in the question, if they mentioned " it is arbitrary tree represented by right child pointers ", then option A is correct.

I hope this question from ACE.

+1

just take the Binary tree,

root is A, left of root is B and right of root is C

left of B is D and right of D is E, and E right is F, F right child is G, G right child is H

right of C is J

What is the answer by you? ( as you said it is 5 due to D have only right child, E have only right child,F have only right child, G have only right child, and C have only right child, )

If you apply the algorithm, what is Answer? only 3.

root is A, left of root is B and right of root is C

left of B is D and right of D is E, and E right is F, F right child is G, G right child is H

right of C is J

What is the answer by you? ( as you said it is 5 due to D have only right child, E have only right child,F have only right child, G have only right child, and C have only right child, )

If you apply the algorithm, what is Answer? only 3.

52,223 questions

59,811 answers

201,020 comments

118,087 users