Zebra0.com

MCC++ Project: Quick Sort

C++ Project: Quick Sort

Template Quick Sort

You are to write a program that does the following:

  1. Write a Template Quick Sort that will sort an array of any type.
  2. Write a Template function that will print an array of any type.
  3. Test the sort with strings, dates, numbers.
  4. You must use a recursive quicksort (a quick sort).
  5. After sorting, print out the ordered list.

The quicksort works as follows. Call quicksort with the the arrays and min and max. If min=max the list has just one element and is thus sorted.

Otherwise use the first element from min to max as a pivot value. Partition the list (from min to max) so that all of the values less than or equal to the pivot value are before it and all of the values greater than or equal to the pivot value are after it. The pivot value is now in its proper place. Call quicksort to sort the list from min to pivot-1 and call quicksort to sort the list from pivot+1 to max.

Sample files: names1, names2


This web site, and all pages therein, are the sole property and responsibility of Zebra0.com.
It is not endorsed, sponsored, or provided by or on behalf of Montgomery College.