Implement a method named “randomArray” in the file named “BSTTest.java” that tests a specific sorting algorithm. This method will take one parameter: size of a randomly generated array (int): e.g., 10 This method will: Generate and return a random array of the length specified by the parameter The value range of each element should be between 0 and 1000 (inclusive) >>> 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 least two cases 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 lines int[] arr = new int[1]; return arr; } // the parameters and return are up to you to define; this method needs to be uncommented // private test() { // // } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Implement a method named “randomArray” in the file named “BSTTest.java” that tests a specific sorting algorithm. This method will take one parameter:

  • size of a randomly generated array (int): e.g., 10

This method will:

  1. Generate and return a random array of the length specified by the parameter
  2. The value range of each element should be between 0 and 1000 (inclusive)

>>> 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 least two cases 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 lines
int[] arr = new int[1];
return arr;
}

// the parameters and return are up to you to define; this method needs to be uncommented
// private test() {
//
// }
}

 

Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education