Question: This program should be done using eclipse and java. 1.Write an implementation of a binary tree data structure in Java. A node should have an
This program should be done using eclipse and java.
1.Write an implementation of a binary tree data structure in Java. A node should have an integer key. The implementation should include methods for inserting a node and a tree walk method. A tree walk method is supposed to output a list of keys sorted in increasing order. Test your program in the main method of one of your classes using the following tests (tests assume the implementation contains classes BinTree with methods insertNode and treeWalk and a class Node):
// testcase 2
System.out.println();
System.out.println("testcase 1:");
BinTree binTree2 = new BinTree();
binTree2.insertNode(new Node(3));
binTree2.insertNode(new Node(201));
binTree2.insertNode(new Node(60));
binTree2.insertNode(new Node(30));
binTree2.insertNode(new Node(45));
binTree2.treeWalk();
// testcase 3
System.out.println();
System.out.println("testcase 2_1:");
BinTree binTree3 = new BinTree();
binTree3.insertNode(new Node(-10));
binTree3.insertNode(new Node(-150));
binTree3.insertNode(new Node(4));
binTree3.insertNode(new Node(300));
binTree3.insertNode(new Node(45));
binTree3.treeWalk();
binTree3.insertNode(new Node(-50));
binTree3.insertNode(new Node(200));
System.out.println();
System.out.println("testcase 2_2:");
binTree3.treeWalk();
The files of the problem should be archived into one archive file named BinTree
Classes should be in package binTree.
The archive file should contain:
1.UML class diagram for the program generated by the SDE plug-in
2.Commented source code (comments per each class and method)
3.API docs produced by javadoc
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
