unsorted_array[pivot_indexunsorted_array[less_than_pivot_indexunsorted_array[less_than_pivot_indexpivot return less_than_pivot_index an if statement has been inserted at the beginning of the function definition to cater for situations where first_index is equal to last_index in such casesit means there is only one element in our sublist we therefore simply return any of the function parametersin this casefirst_index the first element is always chosen as the pivot this choice to make the first element the pivot is random decision it often does not yield good split and subsequently good partition howeverthe ith element will eventually be found even though the pivot is chosen at random the partition function returns the pivot index pointed to by less_than_pivot_indexas we saw in the preceding from this point onyou will need to follow the program execution with pencil and paper to get better feel of how the split variable is being used to determine the section of the list to search for the ith-smallest item deterministic selection the worst-case performance of randomized selection algorithm is ( it is possible to improve on section of the randomized selection algorithm to obtain worst-case performance of (nthis kind of algorithm is called deterministic selection the general approach to the deterministic algorithm is listed here select pivot split list of unordered items into groups of five elements each sort and find the median of all the groups repeat step and step recursively to obtain the true median of the list use the true median to partition the list of unordered items recurse into the part of the partitioned list that may contain the ith-smallest element