Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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