subject
Computers and Technology, 22.07.2021 23:40 DeonJ

In this lab you will need to write a c program and an excel file. You will need to submit both your code and the excel file in the webcourses.
Experimental Study of the Execution Times of the Sorting Algorithms
In this lab,
you will perform experimental study on the sorting algorithms we have learned so far.
You are asked to compare execution time of the following sorting algorithms:
selection sort, bubble sort, insertion sort, merge sort
, and quick sort
All of these algorithm source codes in c are available in your main course webcourses.
So, copy
them as you need.
In order to do the
comparison, you will need to
:
1) Create an array and fill it with random numbers
2) Pass this array to each sorting algorithms
3) Write down the execution time for each algorithm in an excel file and plot them to see how the execution time changes with time.
A good idea could be creating an array containing the total number of data you want to produce at each phase. For example, A sizes array with total number of elements for each test cases
[1000, 10000, 20000, 40000, 50000, 100000]
can be useful to generate 1000 number, 10K
number, and so on.
You may find the following hints useful:
1) To generate random numbers between [1,
maxVal
] you can use the rand function:
n =
rand()
%
maxVal
+ 1;
Just put this line in your for loop and store n in the array.
2) To calculate the execution time you can use the following technique
: int start = time(0);
bubbleSort(sortedArray, sizes[i]);
int end = time(0);
printf("Sorting %d values took %d seconds for Bubble sort.\
n", sizes[i], end
-start);

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:00
How do we use the sumif formula (when dealing with different formats) ?
Answers: 1
question
Computers and Technology, 24.06.2019 12:30
Do you think media is stereotype ? and why?
Answers: 1
question
Computers and Technology, 25.06.2019 01:30
What controls can be found on the file tab of microsoft word
Answers: 1
question
Computers and Technology, 25.06.2019 06:10
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game behind everything else d. in front of everything else select the best answer from the choices provided
Answers: 1
You know the right answer?
In this lab you will need to write a c program and an excel file. You will need to submit both your...
Questions
Questions on the website: 13722362