Question: The students have to implement insertion sort and selection sort algorithms and then test their performance using any online C compiler. After the students have
The students have to implement insertion sort and selection sort algorithms and then test their performance using any online C compiler. After the students have coded the algorithms, it should be tested for how long each sorting algorithm takes to run for both random array and sorted array. The testing conditions are below 1. Test for sorted array of size 1000 and 100000 (fill array using a simple for loop) 2. Test for unsorted array of size 1000 and 100000 (fill array using use rand() function) Notes: a. Use microsecond to print time. The below functions help to get time in microseconds /** Returns the current time in microseconds. */ long getMicrotime struct timeval currentime; gettimeofday(dcurrentTime, NULL); return currentime.tv_sec * (int)1e6 + currentTime.tv_usec; ? b. Online compiler example, https://www.onlinegdb.com/online c compiler c. Use rand functions to fill input array Deliverables: The report should contain the performance details of both sorting programs for different input size for a sorted arrays and unsorted arrays. Marking Scheme Marking Scheme 5 marks C program for insertion sort 5 marks C program for selection sort 5 marks Report with performance details and comparison
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
