Question: class tree is attached under the question below: import java.io.IOException; import java.util.Stack; public class Tree { private Node root; // first node of tree //

class tree is attached under the question below:

 class tree is attached under the question below: import java.io.IOException; import

import java.io.IOException; import java.util.Stack; public class Tree { private Node root; // first node of tree // ------------------------------------------------------------- public Tree() // constructor { root = null; } // no nodes in tree yet // ------------------------------------------------------------- public Node find(int key) // find node with given key { // (assumes non-empty tree) Node current = root; // start at root while(current.iData != key) // while no match, { if(key   To class Tree, add the following function: * nodesInLevel(int x): returns number of nodes in a specific level x. for example in this tree, nodesInLevel(2) is 4 19 4 17 43 * depthFirst O: which a traversal approach that prints the nodes of the tree level bv level, for this tree, this method should print 11619 4 8 1743 5 10 31 49 10 31 49

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!