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




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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
