Question: uthors of modern software libraries are nice enough to include a sort ( ) function for use in applications. These libraries claim that the sort
uthors of modern software libraries are nice enough to include a sort function
for use in applications. These libraries claim that the sort functions use an algorithm that is at least
On lgn in nature. Lets test this claim by writing a small program.
In your language of choice, use the sort routine provided by the language to sort randomly generated
data sets of and integers. Since we are looking at average data
set sizes, you will need to sort at least or more random data sets for each data set size.
You should implement an algorithm that looks like this:
Algorithm : Test the order of the library sort
Output: A data set of run times for each data set size
for size in do
Set totalRunTime ;
for runNumber in NumberOfRuns do
GenerateRandomDataSet dataSetsize;
Note start time;
Sort dataSet;
Note end time;
Set elapsed time to difference between end and start times;
Add elapsed time to totalRunTime;
Set averageRunTime totalRunTime NumberOfRuns;
The function GenerateRandomDataSetdataSet size needs to generate a random set of integers
of whatever size is passed into the function as an input
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
