Question: In C++ write a program to analyze run-time complexity of Quicksort and Heap sort(on the same input). Input should be in range of 10 to

In C++ write a program to analyze run-time complexity of Quicksort and Heap sort(on the same input). Input should be in range of 10 to 50000. The program should generate random number arrays of size 500,1000,5000 and 10,000 numbers(or any other number multiple of 500 entered by user). Now apply heap sort and Quicksort on these random arrays and print executions of each. Keep asking the input size from the user and repeat the whole process until user gives the input size as -1. Later display all the execution times in the form of table.

Sample Input : 500

: 1000

: 5000

: -1

Output:

SL.No

Array Size

Type of Algorithm used

Execution Time

1

500

Quicksort

0.3Secs

2

1000

Heap sort

0.2Secs

3

2000

Quicksort

0.1Sec

4

2000

Heap sort

0.3Secs

5

5000

Quicksort

0.4Secs

6

5000

Heap sort

0.2Secs

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!