apple banana suppose that we have an application in which we have list of strings that are all known to represent integral values ( )and our goal is to sort the strings according to those integral values in pythonthe standard approach for customizing the order for sorting algorithm is to provideas an optional parameter to the sorting functionan object that is itself one-parameter function that computes key for given element (see sections and for discussion of this approach in the context of the builtin max function for examplewith list of (numericstringswe might wish to use the value of int(sas key for string of the list in this casethe constructor for the int class can serve as the one-parameter function for computing key in that waythe string will be ordered before string because its key int int we leave it as an exercise to support such an optional key parameter for the pq sort function (see exercise - selection-sort and insertion-sort our pq sort function works correctly given any valid implementation of the priority queue class howeverthe running time of the sorting algorithm depends on the running times of the operations add and remove min for the given priority queue class we next discuss choice of priority queue implementations that in effect cause the pq sort computation to behave as one of several classic sorting algorithms selection-sort if we implement with an unsorted listthen phase of pq sort takes (ntimefor we can add each element in ( time in phase the running time of each remove min operation is proportional to the size of thusthe bottleneck computation is the repeated "selectionof the minimum element in phase for this reasonthis algorithm is better known as selection-sort (see figure as noted abovethe bottleneck is in phase where we repeatedly remove an entry with smallest key from the priority queue the size of starts at and incrementally decreases with each remove min until it becomes thusthe first operation takes time ( )the second one takes time ( )and so on thereforethe total time needed for the second phase is ( ( (ni= iby proposition we have ni= ( )/ thusphase takes time ( )as does the entire selection-sort algorithm