Question: Please code in C++: Update the code with three methods of (Selection Sort), (Insertion Sort), and (Merge Sort) and place them in there separate void

Please code in C++:

Update the code with three methods of (Selection Sort), (Insertion Sort), and (Merge Sort) and place them in there separate void function.

Functions or classes are ok.

Create an array that holds 1000 random floats between 1-1000.

Implement Selection Sort to sort the values in ascending order. Least Greatest

Implement Insertion Sort to sort the values in ascending order. Least Greatest

Implement Merge Sort to sort the values in ascending order. Least Greatest

Measure the time it takes to execute the sort in milliseconds or even nanoseconds using the clock(); method

Please run the sort 3 times.

// Here is my code below:

#include #include #include using namespace std;

int main(){ srand(time(NULL)); int arr[1000]; for(int i=0;i<1000;i++){ arr[i] = rand()%1001; } int choice; do{ cout << "************************************************* " << "* 1: Selection Sort * " << "* 2: Insertion Sort * " << "* 3: Merge Sort * " << "************************************************* " <<"Enter choice : "; cin>>choice;

switch(choice){ case 1:{ break; } case 2:{ break; } case 3:{ break; } default: cout << "Invalid!" << endl;

} } }while(choice!=3); return 0; }

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!