Homework 7
Document last modified:
Overview
Profiling program execution provides detailed empirical data on algorithm performance at different levels of granularity and measures.
The project uses a profiling system to acquire runtimes of three different sorting algorithms under varying problem sizes and initial orderings (sorted or random).
You do not need to program for the project but will need to make minor edits to one file and rerun under different test conditions.
Purpose of Project
Project Software
Visual Studio Project
|
![]() |
DevPartner Profiler
|
![]() |
Assignment
- Make 36 runs of the driver
- run exchange sort 1 time on 6 different sets of integers already sorted in non-increasing order, the set sizes are:
500, 1000, 2000, 4000, 8000, 16000- run exchange sort 1 time on 6 different sets of randomly generated integers, the set sizes are:
500, 1000, 2000, 4000, 8000, 16000- run quick sort 1 time on 6 different sets of randomly generated integers, the set sizes are:
500, 1000, 2000, 4000, 8000, 16000- run quick sort 1 time on 6 different sets of integers already sorted in non-increasing order, the set sizes are:
500, 1000, 2000, 4000, 8000, 16000- run merge sort 1 time on 6 different sets of randomly generated integers, the set sizes are:
500, 1000, 2000, 4000, 8000, 16000- run merge sort 1 time on 6 different sets of integers already sorted in non-increasing order, the set sizes are:
500, 1000, 2000, 4000, 8000, 16000- Note:
- the driver has been constructed so that it takes command line arguments
- you can supply the size of the problem as 1st argument, e.g., 2000
- if you supply any 2nd argument, the driver will load sorted data instead of random data
- From Visual Studio, you can set the command line arguments by bringing up the project's property page dialog and selecting:
- Configuration Properties | Debugging
- then typing in the arguments you want in the 'Command Arguments' edit box.
- Rerun the program to execute the new command line arguments.
- For each run record in an Excel table the following information:
- Operation called: Exchange_Sort, Quick_Sort, or Merge_Sort
- How integers were generated: Randomly or sorted non-increasing
- Number of times operation (Exchange_Sort, Quick_Sort, or Merge_Sort) was called
- Average running time of the called operation (Exchange_Sort, Quick_Sort, or Merge_Sort). The average running time appears in a column labeled "Average".
- Number of items sorted
- Compute the following for each run using the collected data:
- Total time spent in operation
- Time spent per item
- A math function constructed by you that takes the number of items sorted as its only parameter and outputs an approximation to the actual total time (see Task C, Item #1) spent in the operation
- The ratio of Item #3 to Item #1. Rework Item #3 in an attempt to drive the ratio to 1.0
The resulting table should have following columns:
1 2 3 4 5 6 7 8 9 Sorting
AlgorithmRandom
or Sorted# Items
SortedTimes Sort
Op CalledAverage
Run TimeTotal Time
SpentTime Spent
per itemMath
FunctionRatio
Col #6/#8
Turn In
No hand written answers accepted