Starting from:
$35

$29

CIS 3130 HW Assignment #6

Write a complete program, to collect statistics on a series of sorts

The main program will continue the following until the end of the set of data.

  1. Call a method to read in a group of numbers to be sorted.
  2. Call 3 methods (or put into 1 if you wish) to sort these values using 3 different sorts.
  3. Call a method to compare the 3 sorts.

Step 1: The read method will first read a heading describing the group of numbers (ie: - the heading maybe 10 numbers in order, 50 numbers in random order or 100 numbers in reverse order). Then it will read in a group of numbers. The original group should be printed out as it is read in.

Step 2: The three sorts should all receive the data in their original order before sorting.

  1. One sort will be an inefficient one like the Bubble sort
  2. The second sort should be an efficient sort like the Quicksort
  3. The 3rd sort can be any one of your choice

After each individual sort finishes the sorted array should be printed. You should add code and then print for each sort the number of comparisons and/or interchanges that each of the 3 sorts required. You can use global variables to track these counts.

You can then compare the 3 types of sorts to see for each set which did the best most efficient job.

Remember that each group of data must start with a heading describing what it is testing. You are allowed to have repeats in the group but there should not be too many repeated values. You should include at least the following 9 groups (the heading for a group can be what I use to describe it).

Data to be used:

  1. 10 numbers in almost sorted order (a few out of order)
  2. 10 numbers in random order
  3. 10 numbers in reverse order (a few out of order)
  4. 30 numbers in almost sorted order (a few out of order)
  5. 30 numbers in random order
  6. 30 numbers in reverse order (a few out of order)
  7. 50 numbers in almost sorted order (a few out of order)
  8. 50 numbers in random order
  9. 50 numbers in reverse order (or almost reverse)


More products