Question: Use the following files to write a java program that implements a binary tree. The program should use an array and fill the elements from
Use the following files to write a java program that implements a binary tree. The program should use an array and fill the elements from the array into a tree structure. The program should produce output as shown below when inserting array elements.

Tree Class:
public class Tree { @SuppressWarnings("unused") public Tree(int[] array) { Node root = new Node(array[0]); root.setRoot(true); Node current = root; int level = 0; for(int i=1; i TreeDriver Class: public class TreeDriver { @SuppressWarnings("unused") private int [] array = {8,3,5,7,1,6,4,9,2,0}; //private int [] array = {1,2,3,4,5,6,7,8,9}; } Node Class: public class Node { private int value; private Node left; private Node right; private boolean isRoot=false; public Node(int value) { } public int getValue() {return value;} public void setValue(int value) {this.value = value; } public Node getLeft() {return left;} public void setLeft(Node left) {this.left = left;} public Node getRight() {return right;} public void setRight(Node right) {this.right = right;} public boolean isRoot() {return isRoot;} public void setRoot(boolean isRoot) {this.isRoot = isRoot;} }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
