Fill This Form To Receive Instant Help
Homework answers / question archive / Discreet Structures/Math THE PROJECT The purpose of the project is to perform a timing experiment
Discreet Structures/Math
THE PROJECT
The purpose of the project is to perform a timing experiment. You are required to complete the following activities:
1 and 2 are primarily intended to make sure that your algorithms work.
Once you are convinced your programs work, do the following
Initiate a variable running_time to 0
Create a for loop that iterates 1000 times.
In the body of the loop,
Create an array of n random integers (Make sure you make the range of the random numbers substantially bigger than the array, ie. if the array size is 500 have the random number generator pick numbers between 1 and 5000. For the largest array have the random number generator pick numbers between 1 and 50,000).
Get the time and set this to start-time (notice the sort is started after each array is built. You want to time the srt process only). You will have to figure out what the appropriate command is in the programming language you are using to find the time (Important: Do not start the timer until after the array is created).
Use bubble sort to sort the array
Get the time and set this to end-time Subtract start-time from end-time and add the result to total_time
Once the program has run, note
The number of items sorted
The average running time for each array (total_time/1000)
Repeat the process using 500, 2500 and 5000 as the size of the array.
Please submit
Please download the answer files using this link
https://drive.google.com/file/d/1ytd6E8CSXYFGASHu9-Rh062rROxDgZ9h/view?usp=sharing