Question: Focus on Sorting Algorithms and Object - oriented programming task: write a class, namely sorting, that contains at least seven functions: ( 1 ) constructor

Focus on Sorting Algorithms and Object-oriented programming
task: write a class, namely sorting, that contains at least seven functions: (1) constructor that initializes all the data members if any; (2)start function that reads the data size and maximum number in the list from the keyboard, then generates data set, then call a proper function to sort; (3) selection sort function that carries out a selection sort and counts how many comparisons and moves; (4) insertion sort that conducts an insertion sort and counts how many comparisons and moves; (5) quick sort function that does a quick sort and counts how many comparisons and moves; (6) merge sort function that performs a merge sort and counts how many comparisons and moves; and (7) print function that prints the first 15 elements of the sorted list and the sorting results.
dom number generator to produce a set of random numbers, and then make enough copies for your sorting algorithms. Then sends a copy of the list to each of sorting algorithms. Finally, each algorithm produces a sorting report.
Input:
Your program needs two integers from keyboard: the size of list and maximum number in your list.
Output:
The first 20 elements in the sorted list, # of comparisons from each sorting algorithm.
Your one runs output may look like:
Enter list size: 100
Enter max number in the list: 100
Unsorted list:
892321510341818840363715282130....
Sorted List:
Select Sort: 112223333444455...
Insertion Sort: 112223333444455...
Quick Sort: 112223333444455...
Merge Sort: 112223333444455...
......
Sorting Results:
Algorithm Comparisons
Select 4950
Insertion 2048
Quick ...
Merge ...
......

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!