recall that sorting algorithm is said to be stable if the original ordering for duplicate keys is preserved we can make any algorithm stable if we alter the input keys so that (potentiallyduplicate key values are made unique in way that the first occurrence of the original duplicate value is less than the second occurrencewhich in turn is less than the thirdand so on in the worst caseit is possible that all input records have the same key value give an algorithm to modify the key values such that every modified key value is uniquethe resulting key values give the same sort order as the original keysthe result is stable (in that the duplicate original key values remain in their original order)and the process of altering the keys is done in linear time using only constant amount of additional space the discussion of quicksort in section described using stack instead of recursion to reduce the number of function calls made (ahow deep can the stack get in the worst case(bquicksort makes two recursive calls the algorithm could be changed to make these two calls in specific order in what order should the two calls be madeand how does this affect how deep the stack can become give permutation for the values through that will cause quicksort (as implemented in section to have its worst case behavior assume is an arraylength(lreturns the number of records in the arrayand qsort(lijsorts the records of from to (leaving the records sorted in lusing the quicksort algorithm what is the averagecase time complexity for each of the following code fragments(afor ( = < lengthi++qsort( )(bfor ( = < lengthi++qsort( length- ) modify quicksort to find the smallest values in an array of records your output should be the array modified so that the smallest values are sorted in the first positions of the array your algorithm should do the minimum amount of work necessary modify quicksort to sort sequence of variable-length strings stored one after the other in character arraywith second array (storing pointers to stringsused to index the strings your function should modify the index array so that the first pointer points to the beginning of the lowest valued stringand so on