Question
Your exercise will involve creating a main program to create the array, call the sort function and display the sorted results. The array will contain
Your exercise will involve creating a main program to create the array, call the sort function and display the sorted results. The array will contain 10000 elements and will be filled with double values from a random number generator. Random doubles may be generated by the repeated calling of the random function from the Java Math library, as follows:
// fill an existing array with random doubles
for (int i = 0; i < 10000; ++i)
{
ArrayToBeSorted[i] = Math.random( );
}
This will fill an array named with 10000 random doubles, values between 0.0 and 0.99999999 (1.0 wont be used).
Testing:
There is no good reason to display 10,000 numbers since no human would be able to see if an out-of-order situation exists. So the final part of the main program will contain a loop that will compare each element to the one immediately after it in the sorted array and display a message if they are out of order.
Testing will consist of running the program. Since the elements are random and it checks itself for correct sorting, no further testing is necessary.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started