Home‎ > ‎Assignments‎ > ‎

Sorting Through Sorting

Write a program which will help you compare the three basic sorts (selection, insertion, bubble) with regard to number of compares and number of record moves as each sort in turn sorts a common list of (say, 50) more-or-less randomly ordered records.  Each record consists of at least a part number and a quantity.

Your program should print the unsorted list once, and then print the sorted list after each sort together with the two metrics for that sort: the count of the key compares needed and the count of the record moves.  (Note that an exchange normally requires three moves.)  Use appropriate heading. 

Part B.  Run twice for lists of  size 50 records and 100 records.  Prepare a comparison table (type of sort used by number of records) and write a paragraph giving conclusions you have drawn from this exercise.
Comments