Question: Java Program : You are to write a program name BSTree.java that will: Generate 100 random integer numbers ranging from 1 99. Store these numbers
Java Program :
You are to write a program name BSTree.java that will:
Generate 100 random integer numbers ranging from 1 99.
Store these numbers in a data structure of your choice and display the data on the screen. DO NOT SORT THIS DATA STRUCTURE.
Now build a Binary Search Tree using this set of numbers. You MUST insert the values into the tree starting from the first element of your Data Structure and go sequentially.
After building the tree, use an infix recursive method to display the data on the screen.
To build the Binary Search Tree, you must create your own Linked List.
Can you please tell me correct my code to where it runs?
package bstree;
/** * * @author hgnel */ public class Node { int data ; Node left; Node right; public Node (int input) { this.data = input; } public void setleft(Node input){ left = input; } public void setright(Node input){ right = input; } }
package bstree;
import java.util.ArrayList; import java.util.LinkedList; import java.util.Random; import static jdk.nashorn.tools.ShellFunctions.input; public class BSTree {
public static void main(String[] args) { ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
