Question: this is the main program to test the output Question 1 Sorting algorithms Write a C program to implement selection and quick algorithms. It requires

 this is the main program to test the output Question 1
Sorting algorithms Write a C program to implement selection and quick algorithms.
this is the main program to test
It requires a header program mysort.h containing function headers of the following
specifications, and mysort.c which implements the functions. Define an enumeration type nimed
the output
BOOLEAN with name false as 0 and true as 1. This function

Question 1 Sorting algorithms Write a C program to implement selection and quick algorithms. It requires a header program mysort.h containing function headers of the following specifications, and mysort.c which implements the functions. Define an enumeration type nimed BOOLEAN with name false as 0 and true as 1. This function tests if array a[n] is sorted in increasing order between index left and right, and returns true if yes, otherwise false. */ BOOLEAN is_sorted (int *a, int left, int right): This function sorts the eletients of int array * from index left to right in increasing order, using the selection sort algorithm #/ void select sort(int *a, int left, int right): This function sorts the elements of int array *a from index loft to right in increasing order, using the quick sort algorithm void quick_sort(int *a, int loft, int right): This function swaps the values at referenced locations. It is an auxiliary function for the sorting functions. void swap(int *x int *y): . Use the provided testing program mysort main.c to test your program. Note that the time measuring numbers vary with system and runtime. Public test Help for question 1 Sorting algorithms mysort.h your signature #ifndef MYSORT_H #define MYSORT_H W define enum type BOOLEAN void select_sort(int *a, int left, int right): void quick_sort(int *a, int left, int right): Hendit mysort.c W your program signature #include mysort.h" BOOLEAN is sorted (int *a, int left, int right) your implementation void select_sort(int *a, int left, int right) your implementation void quick_sort(int *a, int left. int right) your implementation void swap(int *first. int *second) int temp = *first: *first = *second: *second = temp: nclude include Enclude include "mysort.h" oid display_array(int *a, int n) int i; for (i=0; i t2 clock double tine_span2 = (double) t2-t1; printf("tine span(quick sort(Xd numbers) for Xd times)(s):20.1f ", len, m2, time_span2); printf(tine_span(selection_sort(x4 numbers/time span(quick_sort(%d numbers): 0.1f ", len, len, (tine_span1/10)/(tine_span2/m2)); . return; gcc mysort. c mysort_main. c -o q1 q1 Algorithm correctness testing: Algorithm correctness testing: a[]:3, 1, 4, 5, 2, 7, 6, 9, 8, is_sorted (a): 0 Selection sort:1, 2, 3, 4, 5, 6, 7, 8, 9, is_sorted (b) :1 Quick sort: 1, 2, 3, 4, 5, 6, 7, 8, 9, is_sorted (b):1

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!