figure an abstract showing how quick sort merges the sorted segments and pivot value back into the original sequence implementation simple implementation using the slice operation can be devised for the quick sort algorithm as was done with the merge sort but it would require the use of temporary storage an efficient solution can be designed to work with virtual subsequences or segments that does not require temporary storage howeverit is not as easily implemented since the partitioning must be done using the same sequence structure python implementation of the quick sort algorithm is provided in listing the quicksort(function is simple wrapper that is used to initiate the recursive call to recquicksort(the recursive function is rather simple and follows the enumerated steps described earlier note that first and last indicate the elements in the range [first lastthat comprise the current virtual segment the partitioning step is handled by the partitionseq(function this function rearranges the keys within the physical sequence structure by correctly positioning the pivot key within the sequence and placing all keys that are less than the pivot to the left and all keys that are greater to the right as shown herefirst pivot last pivot pos the final position of the pivot value also indicates the position at which the sequence is split to create the two segments the left segment consists of the elements between the first element and the pos element while the right segment consists of the elements between pos and lastinclusive the virtual segments