Starting from:
$30

$24

Lab 4 Sorting II Solution




Feel free to discuss and help each other out but does not imply that you can give away your code or your answers! Make sure to read all instructions before attempting this lab. You can work with a lab partner and submit one lab package for your group.




You must use an appropriate provided template from Canvas or my website (zeus.mtsac.edu/~tvo) and output "Author: Your Name(s)" for all your programs. If you are modifying an existing program, use "Modified by: Your Name(s)".




Lab question 1: What are some options for picking a pivot for quick sort? Which one do you recommend and why?







Lab question 2: Given the quick sort algorithm provided in the book, what kind of list would end up with a worst-case running time of O(n2)?







Implement the quick sort algorithm provided in the book and test it on a list of 20 randomly generated integer values in the range [0, 999].







Implement bucket sort algorithm in the book and test it on a list of 100 randomly generated integer values in the range [0, 999].




Extra Credit: Implement quick sort algorithm in the book, but use random pivot and test it on a list of 100 randomly generated integer values in the range [0, 999].







Online Submission: Submit one PDF file via Canvas includes status, answers to lab questions, output and source code for all required programs.

More products