Question: You will be writing a function with this specification: void quicksort (voids * base, size_t n, size_t bytes, int compar (const void*, const void*)) precondition

 You will be writing a function with this specification: void quicksort

You will be writing a function with this specification: void quicksort (voids * base, size_t n, size_t bytes, int compar (const void*, const void*)) precondition base is a pointer to the first component of an array with at least n elements The component of the array may be any type at all, and the parameter bytes must be the number of bytes in each component of the array. The fourth parameter compar, must be the name of a function that can compare two elements of the array. The two arguments of compar are pointers to two elements in the array, and the return value of compar indicates which of the two arguments is largest, as follows: a negative return value means that the 2nd argument is larger a zero return value indicates that the arguments are equal a positive return value means that the 1st argument is larger Post condition: The elements of the array have been rearranged so that they are in order from smallest to largest This specification includes several new items that you haven't seen before, such as the third parameter (which must be the number of bytes required by one component of an array) and the fourth parameter (where the actual argument must be a function that you write and make available to the quicksort function)

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!