CSC148H5 Lecture Notes - Lecture 19: Quicksort, Insertion Sort, Merge Sort

192 views1 pages
4 May 2016
School
Course
Professor

Document Summary

Take right most element compare to all elements if smaller than element switch element with left most element of the partition (partition seperates sorted list from unsorted) Stuff to the left of the i are less than the pivot. Stuff from i up to but not including j is the processed elements. Rearrange lst so elements >= pivot follow elements < pivot; return index of first element >= pivot i = left j= left while j <= right: return i. Old sort selection sort at the rest of the not sorted list. Insertion sort insert it into the correct area in the unsorted list. Quick sort it to the left and more than it to the right and then runs the rest o.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents