1.

Which of the following statement is false in context of tree terminology?(a) Root with no children is called a leaf(b) A node can have three children(c) Root has no parent(d) Trees are collection of nodes, with a parent child relationshipI got this question during an interview for a job.This interesting question is from Construction and Yield of a Parse Tree in section Context Free Grammars and Languages of Automata Theory

Answer»

The correct choice is (a) Root with no children is called a leaf

Easy explanation: A NODE has atmost one parent, drawn above the node, and ZERO or more children drawn below. Lines CONNECT PARENTS to children. There is one node, one root, that has no parent; this node appears to be at the TOP of the tree. Nodes with no children are called leaves. Nodes that are not leaves are called interior nodes.



Discussion

No Comment Found

Related InterviewSolutions