-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lecture "Divide and conquer algorithms", exercise 3 #28
Labels
Comments
|
|
Nuntio vobis magno gaudio, I got to a working quicksort algorithm.
|
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Implement in Python the divide and conquer quicksort algorithm – i.e. the recursive
def quicksort(input_list, start, end)
. It takes a list and the positions of the first and last elements in the list to consider as inputs. Then, it callspartition(input_list, start, end, start)
(defined in the previous exercise) to partition the input list into two slices. Finally, it executes itself recursively on the two partitions (neither of which includes the pivot value since it has been already correctly positioned through the execution of partition). In addition, define the base case of the algorithm appropriately to stop if needed before to run the partition algorithm. Accompany the implementation of the function with the appropriate test cases. As supporting material, Fekete and Morr released a nonverbal definition of the algorithm which is useful to understand the rationale of the binary search steps.The text was updated successfully, but these errors were encountered: