Question: This homework is to compare the execution time for different sorting algorithms. You 1. need to implement one kind of sorting algorithm and compare its

 This homework is to compare the execution time for different sorting algorithms. You 1. need to implement one kind of sorting algorithm and

This homework is to compare the execution time for different sorting algorithms. You 1. need to implement one kind of sorting algorithm and compare its execution time with that of the gsort function in header file stdlib.h. 2. Both of these two sorting algorithms will do sort on arrays which contain z randomly generated integers where the value of r could be 10000, 20000, 40000 and 80000. 3. The whole process of the program is as follows. (a) Set z 10000, randomly generate z integers. Call qsort function to sort these integers and get the execution time. (b) Randomly generate another z integers. Call your own sorting algorithm and get the execution time. (c) Print the above two execution time on the screen. Program terminates if r 80000, otherwise set r r x 2. Hints 1. Dynamic memory allocation and deallocation is suggested but not required. You need to check carefully to make sure your own sorting algorithm works fine. 2. The rand0 function in header file stdlib.h could be used to generate a random integer The sample codes for using the qsort function and measuring the program execution time are listed in hw3.c 3. You may implement selection sort, bubble sort or any other existing sorting algorithm for comparison. You do not need to propose a new kind of sorting algorithm. It is totally fine if your own sorting algorithm is slower than qsort. Sample output CAUsersVli30NDropboxlsort.exe Size Sort my own sort 000000s 10000 0.109000s 20000 0.000000s 2000s 1.763000s 40000 0.000000s 80002 0.000000s 6.942000s

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!