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

 This homework is to compare the execution time for different sorting

This homework is to compare the execution time for different sorting algorithms. You need to implement one kind of sorting algorithm and compare its execution time with that of the sort function in header file styli. Both of these two sorting algorithms will do sort on arrays which contain x randomly generated integers where the value of x could be 10000, 20000 40000 and 80000. The whole process of the program is as follows. Set x = 10000, randomly generate x integers. Call sort function to sort these integers and get the execution time. Randomly generate another x integers. Call your own sorting algorithm and get the execution time. Print the above two execution time on the screen. Program terminates if x = 80000, otherwise set x = x times 2. Dynamic memory allocation and de allocation is suggested but not required. You need to check carefully to make sure your own sorting algorithm works fine. The rand () function in header file styli could be used to generate a random integer. The sample codes for using the sort function and measuring the program execution time are listed in hw3.c 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 sort

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!