1.

An immediate application of a Depth First Search traversal is __________(a) count the number of leaf nodes(b) perform Inorder traversal in easy way(c) count number of nodes(d) implement preorder traversalI have been asked this question by my school principal while I was bunking the class.Query is from Tree Traversal in section Trees of Discrete Mathematics

Answer»

Right option is (a) count the number of LEAF NODES

Easy explanation: GIVEN an n-ary BINARY TREE, by performing DFS traversal on that tree number of leaf nodes can be calculated and for that we need to maintain an array for the leaf count.



Discussion

No Comment Found

Related InterviewSolutions