Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 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
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