Implement the random fill operation. The user command is "f" and the driver should then ask the user for a positive integer indicating how many random strings to generate and put into the tree. Write your random code to generate strings with random lengths between 6 and 10 characters.

While it is not likely that the random generator will create duplicates, we are ignoring duplicates in insert. In the case you do get duplicates, do not count that duplicate as one of the strings being generated. For example, if the user asks for 100 random strings to be inserted, and you get 2 duplicates generated, the tree should not end up with only 98 nodes in it -- it should end up with 100 nodes containing 100 unique values.

1. Create a separate Driver class that it runs 15 times automatically (create a BST, randomly fill it with 65535 strings, compute and save its height)
2. Compute the average height of the 15 BSTs

so the output would look like this...

BST average height: 27.514

BST Runs, each tree with 65,535 random strings
1: height is 25
2: height is 26
3: height is 32
4: height is 29
15: height is 26.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class Driver {

    * @param args the command line arguments
    public static void main(String[] args) {
       int size = 15;
       int randStringNo = 65535 ;
       int [] heights = new int[size];
       double avg = 0.0;
       for (int i = 0; i < heights.length; i++) {
            heights[i] = height(randStringNo);            
            avg += heights[i];
       avg /= (double) heights.length;...
$15.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats