Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education