2 votes 2 votes 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. Programming in C data-structures binary-tree + – Vaishnavi01 asked Sep 28, 2018 edited Mar 11, 2019 by Naveen Kumar 3 Vaishnavi01 642 views answer comment Share Follow See all 8 Comments See all 8 8 Comments reply Magma commented Sep 28, 2018 reply Follow Share I think C) is the correct answer 0 votes 0 votes Shaik Masthan commented Sep 28, 2018 reply Follow Share 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. 0 votes 0 votes Magma commented Sep 28, 2018 reply Follow Share Shaik Masthan can you explain me ?? 0 votes 0 votes Shaik Masthan commented Sep 28, 2018 reply Follow Share 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. 1 votes 1 votes Magma commented Sep 28, 2018 reply Follow Share but why it's traverse the right child only ??? 0 votes 0 votes Shaik Masthan commented Sep 28, 2018 reply Follow Share but why it's traverse the right child only ??? it is algorithm, you can have your own algorithm 0 votes 0 votes Magma commented Sep 28, 2018 reply Follow Share Question is really good .but if this question come in gate I definitely tick option C but tell me one thing it's also hold .option C right ??? 0 votes 0 votes Shaik Masthan commented Sep 28, 2018 reply Follow Share i already gave one example, why option C is wrong. 0 votes 0 votes Please log in or register to add a comment.
3 votes 3 votes According to the given algorithm it just calculates total no of right child of right sub tree only which doesnt matches with any of the options given. Priyanka17 answered Sep 28, 2018 Priyanka17 comment Share Follow See 1 comment See all 1 1 comment reply rish1602 commented Jul 19, 2021 reply Follow Share exactly… the number of right nodes of right sub tree. NONE of the option matches 0 votes 0 votes Please log in or register to add a comment.