cop3502-as3-sample-output.txt
SORT SET: n = 50, all sorts, by weight
Bu
le sort 50 monsters by weight...
Sort complete with 1225 comparisons and 523 swaps.
0.000077s CPU time used
The list is sorted.
Selection sort 50 monsters by weight...
Sort complete with 1274 comparisons and 47 swaps.
0.000030s CPU time used
The list is sorted.
Insertion sort 50 monsters by weight...
Sort complete with 746 comparisons and 44 block copies (1253 total copies).
0.000056s CPU time used
The list is sorted.
Quick sort 50 monsters by weight...
Sort complete with 229 comparisons and 97 swaps.
0.000016s CPU time used
The list is sorted.
Merge sort 50 monsters...
Sort complete with 221 comparisons, 98 block copies, 572 total copies, 49 mallocs.
0.000070s CPU time used
The list is sorted.
Merge-insertion sort 50 monsters...
Sort complete with 398 comparisons, 43 block copies, 742 total copies, 1 mallocs.
0.000020s CPU time used
The list is sorted.
SORT SET COMPLETE
SORT SET: n = 50, all sorts, by name
Bu
le sort 50 monsters by name...
Sort complete with 1225 comparisons and 608 swaps.
0.000098s CPU time used
The list is sorted.
Selection sort 50 monsters by name...
Sort complete with 1274 comparisons and 46 swaps.
0.000046s CPU time used
The list is sorted.
Insertion sort 50 monsters by name...
Sort complete with 658 comparisons and 41 block copies (1143 total copies).
0.000029s CPU time used
The list is sorted.
Quick sort 50 monsters by name...
Sort complete with 303 comparisons and 82 swaps.
0.000022s CPU time used
The list is sorted.
Merge sort 50 monsters...
Sort complete with 216 comparisons, 98 block copies, 572 total copies, 49 mallocs.
0.000048s CPU time used
The list is sorted.
Merge-insertion sort 50 monsters...
Sort complete with 351 comparisons, 41 block copies, 713 total copies, 1 mallocs.
0.000021s CPU time used
The list is sorted.
SORT SET COMPLETE
SORT SET: n = 500, all sorts, by weight
Bu
le sort 500 monsters by weight...
Sort complete with XXXXXXXXXXcomparisons and 60639 swaps.
0.006494s CPU time used
The list is sorted.
Selection sort 500 monsters by weight...
Sort complete with XXXXXXXXXXcomparisons and 495 swaps.
0.001587s CPU time used
The list is sorted.
Insertion sort 500 monsters by weight...
Sort complete with 64603 comparisons and 492 block copies XXXXXXXXXXtotal copies).
0.000949s CPU time used
The list is sorted.
Quick sort 500 monsters by weight...
Sort complete with 5024 comparisons and 2564 swaps.
0.000323s CPU time used
The list is sorted.
Merge sort 500 monsters...
Sort complete with 3861 comparisons, 998 block copies, 8976 total copies, 499 mallocs.
0.000378s CPU time used
The list is sorted.
Merge-insertion sort 500 monsters...
Sort complete with 4611 comparisons, 463 block copies, 9133 total copies, 31 mallocs.
0.000233s CPU time used
The list is sorted.
SORT SET COMPLETE
SORT SET: n = 500, all sorts, by name
Bu
le sort 500 monsters by name...
Sort complete with XXXXXXXXXXcomparisons and 62213 swaps.
0.009424s CPU time used
The list is sorted.
Selection sort 500 monsters by name...
Sort complete with XXXXXXXXXXcomparisons and 495 swaps.
0.004242s CPU time used
The list is sorted.
Insertion sort 500 monsters by name...
Sort complete with 63024 comparisons and 487 block copies XXXXXXXXXXtotal copies).
0.002259s CPU time used
The list is sorted.
Quick sort 500 monsters by name...
Sort complete with 4658 comparisons and 2384 swaps.
0.000391s CPU time used
The list is sorted.
Merge sort 500 monsters...
Sort complete with 3849 comparisons, 998 block copies, 8976 total copies, 499 mallocs.
0.000478s CPU time used
The list is sorted.
Merge-insertion sort 500 monsters...
Sort complete with 4603 comparisons, 459 block copies, 9100 total copies, 31 mallocs.
0.000341s CPU time used
The list is sorted.
SORT SET COMPLETE
SORT SET: n = 5000, all sorts, by weight
Bu
le sort 5000 monsters by weight...
Sort complete with XXXXXXXXXXcomparisons and XXXXXXXXXXswaps.
0.670259s CPU time used
The list is sorted.
Selection sort 5000 monsters by weight...
Sort complete with XXXXXXXXXXcomparisons and 4994 swaps.
0.166510s CPU time used
The list is sorted.
Insertion sort 5000 monsters by weight...
Sort complete with XXXXXXXXXXcomparisons and 4990 block copies XXXXXXXXXXtotal copies).
0.101287s CPU time used
The list is sorted.
Quick sort 5000 monsters by weight...
Sort complete with 70184 comparisons and 34619 swaps.
0.004460s CPU time used
The list is sorted.
Merge sort 5000 monsters...
Sort complete with 55260 comparisons, 9998 block copies, XXXXXXXXXXtotal copies, 4999 mallocs.
0.006112s CPU time used
The list is sorted.
Merge-insertion sort 5000 monsters...
Sort complete with 66743 comparisons, 4615 block copies, XXXXXXXXXXtotal copies, 255 mallocs.
0.003925s CPU time used
The list is sorted.
SORT SET COMPLETE
SORT SET: n = 5000, all sorts, by name
Bu
le sort 5000 monsters by name...
Sort complete with XXXXXXXXXXcomparisons and XXXXXXXXXXswaps.
0.905517s CPU time used
The list is sorted.
Selection sort 5000 monsters by name...
Sort complete with XXXXXXXXXXcomparisons and 4986 swaps.
0.415122s CPU time used
The list is sorted.
Insertion sort 5000 monsters by name...
Sort complete with XXXXXXXXXXcomparisons and 4989 block copies XXXXXXXXXXtotal copies).
0.227113s CPU time used
The list is sorted.
Quick sort 5000 monsters by name...
Sort complete with 67620 comparisons and 33329 swaps.
0.005186s CPU time used
The list is sorted.
Merge sort 5000 monsters...
Sort complete with 55251 comparisons, 9998 block copies, XXXXXXXXXXtotal copies, 4999 mallocs.
0.006659s CPU time used
The list is sorted.
Merge-insertion sort 5000 monsters...
Sort complete with 66666 comparisons, 4597 block copies, XXXXXXXXXXtotal copies, 255 mallocs.
0.004486s CPU time used
The list is sorted.
SORT SET COMPLETE
SORT SET: n = 50000, fast sorts only, by weight
Quick sort 50000 monsters by weight...
Sort complete with XXXXXXXXXXcomparisons and XXXXXXXXXXswaps.
0.059896s CPU time used
The list is sorted.
Merge sort 50000 monsters...
Sort complete with XXXXXXXXXXcomparisons, 99998 block copies, XXXXXXXXXXtotal copies, 49999 mallocs.
0.078171s CPU time used
The list is sorted.
Merge-insertion sort 50000 monsters...
Sort complete with XXXXXXXXXXcomparisons, 46349 block copies, XXXXXXXXXXtotal copies, 2047 mallocs.
0.049662s CPU time used
The list is sorted.
SORT SET COMPLETE
SORT SET: n = 50000, fast sorts only, by name
Quick sort 50000 monsters by name...
Sort complete with XXXXXXXXXXcomparisons and XXXXXXXXXXswaps.
0.075177s CPU time used
The list is sorted.
Merge sort 50000 monsters...
Sort complete with XXXXXXXXXXcomparisons, 99998 block copies, XXXXXXXXXXtotal copies, 49999 mallocs.
0.079564s CPU time used
The list is sorted.
Merge-insertion sort 50000 monsters...
Sort complete with XXXXXXXXXXcomparisons, 46317 block copies, XXXXXXXXXXtotal copies, 2047 mallocs.
0.062662s CPU time used
The list is sorted.
SORT SET COMPLETE
SORT SET: n = 500000, fast sorts only, by weight
Quick sort XXXXXXXXXXmonsters by weight...
Sort complete with XXXXXXXXXXcomparisons and XXXXXXXXXXswaps.
0.722573s CPU time used
The list is sorted.
Merge sort XXXXXXXXXXmonsters...
Sort complete with XXXXXXXXXXcomparisons, XXXXXXXXXXblock copies, XXXXXXXXXXtotal copies, XXXXXXXXXXmallocs.
0.933181s CPU time used
The list is sorted.
Merge-insertion sort XXXXXXXXXXmonsters...
Sort complete with XXXXXXXXXXcomparisons, XXXXXXXXXXblock copies, XXXXXXXXXXtotal copies, 32767 mallocs.
0.759191s CPU time used
The list is sorted.
SORT SET COMPLETE
SORT SET: n = 500000, fast sorts only, by name
Quick sort XXXXXXXXXXmonsters by name...
Sort complete with XXXXXXXXXXcomparisons and XXXXXXXXXXswaps.
0.867876s CPU time used
The list is sorted.
Merge sort XXXXXXXXXXmonsters...
Sort complete with XXXXXXXXXXcomparisons, XXXXXXXXXXblock copies, XXXXXXXXXXtotal copies, XXXXXXXXXXmallocs.
1.031811s CPU time used
The list is sorted.
Merge-insertion sort XXXXXXXXXXmonsters...
Sort complete with XXXXXXXXXXcomparisons, XXXXXXXXXXblock copies, XXXXXXXXXXtotal copies, 32767 mallocs.
0.873227s CPU time used
The list is sorted.
SORT SET COMPLETE
FA2020 COP3502 Programming Assignment 3.pdf
Programming Assignment 3
COP3502 Computer Science I – Fall 2020
Overview
This assignment is intended to make you implement several different sorting algorithms, and the means to analyze their
performance. This assignment is in two parts: a program, and an analysis.
Details
You’ve been given a scattered list of small monsters present in the Knightrola region. You need to evaluate six means of
comparison-based sort to get these monsters in order.
You need to implement six sorts for the monster structure:
• Bu
le sort
• Selection sort
• Insertion sort
• Quick sort
• Merge sort
• Merge sort, switching to insertion sort at ? ≤ 25
Data Structures and Prototypes
We’ve given you two template C files that will help you with implementation.
• integer-sorts-template.c: Contains implementation code for bu
le, selection, and quick sorts against integer
a
ays. IMPLEMENT MERGE SORT AND INSERTION SORT HERE FIRST, AND GET THEM WORKING, TO DEVELOP
YOUR UNDERSTANDING OF THE ALGORITHMS.
• monster-sorts-template.c: Contains the shell for sorting monsters via all six sorts. You may use your code from
integer-sorts-template.c directly, modifying it as necessary to work on the more complex data structures. Don’t
change the structures, the function headers, or any of the helper functions.
So your order of operations should look like this:
•