Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions