Question: C4.2 Sorting Benchmarks: in C++ The purpose of this program is to sort two identical arrays of numbers in ascending order using the bubble sort

C4.2 Sorting Benchmarks: in C++

The purpose of this program is to sort two identical arrays of numbers in ascending order using the bubble sort and selection sort algorithms.

Using the Searching and Sorting Source Code that I provided last week (posted on Moodle), modify the MAIN source code to first generate a random array of integers from 1 to 100 with 100 elements. To help you, the source code that I provide has a function called initArray that will do that for you. Create a copy of the array that gets generated so that you have two identical arrays to be sorted by both sorting functions.

Next, call the bubbleSort function with one of the arrays and report back how many exchanges were done to complete the sort (you will need to modify the bubbleSort function to keep track of the number of exchanges). Second, it should call the selectionSort function with the second (identical) array and report back how many exchanges were done to complete the sort. The results should be displayed on the screen for the user.

Make sure you include and .

Include several test runs of the program to show successful runs of your program, with both valid and invalid data (to show that you are checking for invalid data)

Please ensure the program is well designed and follows accepted style guidelines (e.g. variable naming, indentation, spacing).

Please ensure the program is well documented, including the overall purpose of the program and documenting all the major sections of the code.

NEW: Please ensure your output includes a line that identifies you. For example:

cout << Written by Warren Edwards, INFO 1112 S50 ;

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 Databases Questions!