Question: Consider the implementation of a tree where each node can have arbitrary many children. In the data structure used for storing the tree the children

Consider the implementation of a tree where each node can have arbitrary many children. In the data structure used for storing the tree the children of a given node are organized in a singly linked list using the sibling field and the parent has firstChi ld field. Nodes are storing integer values. The declaration of the Node class for this tree is as follows: class Node \{ int data; Node firstChild; Node sibling; N What is returned by the following function when it is called with a reference to the node marked with a circle in the tree shown above? int bar( Node n ) \{ if(n==null ) return 0; Node cur =n; int a =0; while (cur != null ) \{ a =a+ cur. data; cur = cur.sibling; \} return a; \} 3 A (Enter just the number as your answer.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
