Question: Design and analysis of algorithms Problem 6. Design a C++-program to implement the following functions: a) the function for bubble sorting: int bubblesort (int *a,
Design and analysis of algorithms

Problem 6. 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, 1000,000, and 4000,000 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 bubblesort(.); me2-Get the current time (call a function ); timeCost - the difference between timel and tim2; ); Print your program and test results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
