Question: Given an array of strings, you need to implement a string_sort function which sorts the strings according to a comparison function. The arguments passed to

Given an array of strings, you need to implement a string_sort function which sorts the strings according to a comparison function. The arguments passed to this function are: i) an array of strings: arr ii) length of string array: count iii) pointer to the string comparison function: \( c m p_{\text {_ func }} \) You also need to implement the following two string comparison functions: i) Sort the strings in lexicographically non-increasing order ii) Sort the strings in non-decreasing order of their lengths. If two strings have the same length, then the lexicographically smaller string should appear first. A better implementation would be to write a sorting function that accepts a pointer to the function that compares each pair of strings. Input: You just need to complete the function string_sort and implement the two string comparison functions Output: The output consists of the strings sorted according to the two comparison functions in the order mentioned in the problem statement. Example
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
