Computers and Technology
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);

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:20, Masielovebug
In what kind of attack can attackers make use of millions of computers under their control in an attack against a single server or network availability confidentiality integrity identity automated attack software? those who wrongfully disclose individually identifiable health information can be fined up to what amount per calendar year? single most expensive malicious attack hipaa what are script kiddies? advanced persistent threat security manager security engineer what level of security access should a computer user have to do their job what process describes using technology as a basis for controlling the access and usage of sensitive data? cybercriminal
Answers: 1
image
Computers and Technology, 22.06.2019 09:30, caldonjoshhsms2061
What are the steps involved in accepting all the changes in a document? arrange these in order click edit. click accept or reject. click changes. click accept all.
Answers: 1
image
Computers and Technology, 22.06.2019 19:20, ChaosMind
Write a program that reads a file consisting of students’ test scores in the range 0–200. it should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. output the score ranges and the number of students. (run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.)
Answers: 3
image
Computers and Technology, 23.06.2019 12:00, xojade
Which of these is an example of an integrated presentation? a. a table created in powerpoint b. an image pasted into powerpoint c. a caption created in powerpoint d. an excel chart pasted into powerpoint
Answers: 1
Do you know the correct answer?
In this lab you will need to write a c program and an excel file. You will need to submit both your...

Questions in other subjects:

Konu
Health, 10.11.2020 19:20
Konu
Mathematics, 10.11.2020 19:20