Implement a method named “randomArray” in the file named “BSTTest.java” that tests a specific sorting algorithm. This method will take one parameter:
This method will:
>>> randomArray(5).
>>> [1, 2, 3, 7, 10]
Implement a method named “test” in the file named “BSTTest.java”. This method should take advantage of the implemented randomArray and print out information as such:
Testing of BST starts.
Insert 3
Insert 2
Insert 5
Insert 100
Delete 3.
The traverse gives a BST as 3, 5, 100
Testing of BST ends.
Please note that the goal is not to manually code the printings of each line. Try your best to make this method as automatic as possible. There are no limits on what parameters this method shall accept or what it returns. However, please make sure to use the method to perform testing for at leasttwocases in your main method of BSTTest.java.
Please use the following code as a base.
import java.util.*;
public class BSTTest{public static void main(String[] args) {// perform at least one test on each operation of your BST
}
private int[] randomArray(int size) {// remove the two linesint[] arr = new int[1];return arr;}
// the parameters and return are up to you to define; this method needs to be uncommented// private test() {//// }}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here