Question
Add code to QuickSort and Partition to count the number of comparisons done in sorting a list. def QuickSort2(L, a, b, totalCount): ''' Arranges the
Add code to QuickSort and Partition to count the number of comparisons done in sorting a list.
def QuickSort2(L, a, b, totalCount):
''' Arranges the elements of L between indices a and b in nondescending order and returns the total number
of comparisons perfored. '''
...
return totalCount
def Partition2(L, a, b):
''' Rearranges the elements of L between indices a and b so that all elements
smaller than L[a] lie to the left of L[a]'s new index and all
elements larger than or equal to L[a] lie to the right
then retruns L[a]'s' new index and the number of comparisons performed. '''
...
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started