CSC 111 Lecture Notes - Lecture 7: Bubble Sort, Merge Sort, Quicksort

54 views3 pages

Document Summary

Merge and quick sort: merge sort, key characteristics, halves a list (to a list of one element, divides the list in half, merges sorted list, the sorted list is then merged, ex: 18 7. 4: take whole list and divide it in half. 4: keep doing it until there is a list of only one element. List of one element is already sorted: during off number you decide whether to put it in lower half or upper half. 5: keep dividing until only one item per each, end of divide process, halved it each time. Look at each list and see which is bigger and that goes first. 99: 18, 24, 99, 4, 18, 7, 24, 99, 5, 4, 7, 5. 7 18 24: total of 10 comparisons, each comparison happens due to a greater than/less than, ex: 7 > 18 is false so 7 goes before the 18.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents