- Experiment with sorting data by using well known algorithms and data structures.
- Learn more about vectors, lists, multisets, and priority queues.
- Learn a little about the <ctime> library.
[ http://www.cplusplus.com/reference/clibrary/ctime/ ]
All people taking part in this laboratory must use the laboratory machines
to make the timing comparisons valid.
The following programs all create a either an array or a vector of integers
and sort them.
They repeat this 100 times (constant Sample) with different random data and calculate the average time.
(Sort array using STL sort):
[ timeArraySort.cpp ]
(Bubble Sort):
[ timeBubbleSort.cpp ]
(Linked Insertion Sort):
[ timeInsertionSortLinked.cpp ]
(Sort a list in the STL):
[ timeListSort.cpp ]
(Using a multiset to sort data):
[ timeMultisetSort.cpp ]
(Using a priority queue to sort):
[ timePriorityQueueSort.cpp ]
(Selection Sort):
[ timeSelectionSort2.cpp ]
(The STL Vectore sort):
[ timeVectorSort.cpp ]
(in alphabetical order).
Each has something deleted marked like this /******/ that you
must find, think about, and replace by the correct information.
To put up on the board a table and a graph of times for
different ammounts of data for different sorts.
- Choose one of the above algorithms to experiment with.
- Download it, compile it, fix it,and run the result.
- Note down the output: algorithm, size of data, and mean time.
- Experiment with at least 4 other Sizes. Don't forget to note the results on paper.
- Transfer your results on the white board.
- Repeat with a different program....
- The teacher will start plotting points and drawing graphs the data comes in...
. . . . . . . . . ( end of section Process) <<Contents | End>>