Question: ( python ) TASK 1 ( 2 0 points ) : Implement the quick _ sort Function, you can reference the code on slides of
python TASK points: Implement the quicksort Function, you can reference the code on slides of advanced sorting algorithms
# Run the code to make sure it is working
alist
quicksortalist
printalist
# Task pts: Modify the partition function, instead of using first element of list as pivot
# You will change to choose the last element of list as pivot
# In the test code, you will create a seperate list blist and fill in the blist with random values from range so the elements in blist is from to inclusive
# Print the blist before sorting
#Use the new version of quicksort pivot will be last element of list to sort the blist and print it out
blist
printblist
quicksortblist
printblist
# Task
# Based on the partition function, created another partitionmedian, you will apply the algorithm
# Choose the pivot as the median of three on pg
# Create functions: quicksortmedian and quicksortmedianhelper that call partitionmedian inside
# Test your functions with random generated list, size
clist
printclist
quicksortmedianclist
printclist
TASK points: Implement the quicksort Function, you can reference the code on slides of advanced sorting algorithms
# Run the following code to make sure it is working
alist
quicksortalist
printalist
# Task pts: Modify the partition function, instead of using first element of list as pivot
# You will change to choose the last element of list as pivot
# In the test code, you will create a seperate list blist and fill in the blist with random values from range so the elements in blist is from to inclusive
# Print the blist before sorting
#Use the new version of quicksort pivot will be last element of list to sort the blist and print it out
blist
printblist
quicksortblist
printblist
# Task
# Based on the partition function, created another partitionmedian, you will apply the algorithm
# Choose the pivot as the median of three on pg
# Create functions: quicksortmedian and quicksortmedianhelper that call partitionmedian inside
# Test your functions with random generated list, size
clist
printclist
quicksortmedianclist
printclist
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
