CS 422 Winter 2000, Instructor:
Jeffrey Horn
HOMEWORK 2: EMPIRICAL ANALYSIS OF
RUN_TIME: SORTs
Handed out/Assigned: |
Wednesday,Sept. 13, 2000 |
|
|
Implement your group's sorting algorithm (in C++)
and time it. Produce the following data:
-
UNSORTED INPUT run times (i.e., average case)
-
SORTED INPUT run times (worst case?
best case? neither? depends on your algorithm!)
-
"REVERSE SORTED" INPUT run times (see comment for sorted
input above!)
Assigned Teams:
QUICKSORT |
MERGESORT |
INSERTION SORT |
BUBBLESORT |
HEAPSORT |
RADIXSORT |
"LINUX SORT" |
SELECTION SORT |
|
todd |
|
|
|
|
|
|
keith |
renaye |
mike |
chaplin |
john |
justin |
Dr. Horn |
no one |
jim |
dave |
carlo |
jason |
russ |
zach |
|
|
Here is the "clock" code for measuring CPU time for specific
sections of your code:
-
ESSENTIALS:
-
#include <time.h> before "void main()"
-
Then declare and initialize:
clock_t begin;
clock_t end;
double total_time;
-
then just before the code to be timed, start the clock ticking:
begin = clock();
-
then just AFTER the code to be timed, stop the clock:
end = clock();
-
take the difference and rescale it:
total_time = (end-begin) / (double) CLOCKS_PER_SEC ;
-
then print it:
cout << "\n Total time = " << total_time
<< "\n";
Data so far:
-
UNSORTED INPUT
Excell
Spreadsheet
Web
page
-
SORTED
-
REVERSE SORTED