sequences of the pivot is to have the quicksort algorithm start by randomizing the sequence the quicksort algorithm is given in sect the quicksort code import random def partition(seqstartstop)pivotindex comes from the start location in the list pivotindex start pivot seq[pivotindexi start+ stop- while < #while < and seq[ <pivotwhile < and not pivot seq[ ] += #while pivotwhile < and pivot seq[ ] -= if jtmp seq[iseq[iseq[jseq[jtmp += -= seq[pivotindexseq[jseq[jpivot return def quicksortrecursively(seqstartstop)if start >stop- return pivotindex ends up in between the two halves where the pivot value is in its final location pivotindex partition(seqstartstop quicksortrecursively(seqstartpivotindexquicksortrecursively(seqpivotindex+ stop def quicksort(seq)randomize the sequence first for in range(len(seq)) random randint( ,len(seq)- tmp seq[iseq[iseq[jseq[jtmp quicksortrecursively(seq len(seq)once the list is randomizedpicking random pivot becomes easier the partition function picks the first item in the sequence as the pivot the partitioning starts from this copy belongs to 'acha