The program should display the array values before sorting


Question: Consider the two algorithm optimization proposals QuickSortOpt1 and QuickSortOpt2, explains below.

QuickSortOpt1 executes QuickSort until partitions size gets lower than a given cutoff value (usually 10) and then, executes InsertSort for sorting the small partitions.

QuickSortOpt2 executes QuickSort until partitions size gets lower than a given cutoff value (usually 10) and then, executes InsertSort on the whole "almost sorted" array.

Implement and design a Java program which defines an array of size SIZE, randomly populated with Integer or int values in the range 1 .. MAXRNG and sorts the array in increasing order of its values using QuickSortOpt1 and then by QuickSortOpt2. Consider two program execution cases defined by the value of the boolean constant SHOW.

a) The program should display the array values before sorting and then after invoking each sorting method. For this case, consider SIZE value 100 and MAXRNG value 9999.

b) Measure the execution time of the three sorting algorithms using System.nanoTime() method and display their average values for 10 runs (array values should not be shown). Fill-in the table below with the measured values considering SIZE value 100,000 and MAXRNG value 999,999. Discuss the results.

I'm not sure how to solve the question. Can anyone help me?

Request for Solution File

Ask an Expert for Answer!!
Data Structure & Algorithms: The program should display the array values before sorting
Reference No:- TGS0949164

Expected delivery within 24 Hours