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

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: cmp_func You also need to implement the following two string comparison functions: i) Sort the strings in lexicographically non-decreasing order ii) Sort the strings in non-decreasing order of the number of distinct characters present in them. If two strings have the same number of distinct characters present in them, 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: 4Input: wkue qoi sbv fekls Output: fekls qoi sbv wkue qoi sbv wkue fekls

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!