Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4.)Design a C++ Program to implement the following functions: a.)the function fo

ID: 640794 • Letter: 4

Question

4.)Design a C++ Program to implement the following functions:

a.)the function for bubble sorting : int bubblesort(int*a,int size).

b.)the function for merge sorting : int mergesort(int*a,int size).

c.)the function for generating array of random elements: int generate(int*a,int size) which calls the function rand() in c++.

d.)Test both bubble sorting and merge sorting with 10,100,1000,10000,100000 and 1000000,4000000 integers.The integers are from the array generated by part c).calculate the time spent in calling each sorting.you may use a function in to get the current time.Draw curves to compare the speed performance between the two functions.The merge sorting algorithm implementation must use recursion.you are expected to define a global array for holding result from merging two arrays.otherwise,it may cause a lot extra money in recursion.

Hint 1:use the following format to calculate the time cost for bubble sort. {

Explanation / Answer

1)

#include<iostream>

using namespace std;

int i, j, temp;

void BubbleAsc(int [], int);

int main ()

const int max = 10;

int arr[max] = {22,5,67,98,45,32,101,99,73,10};

cout<<

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote