CSC108H1 Lecture Notes - Lecture 27: Insertion Sort, Selection Sort, Bubble Sort

21 views4 pages
yifanyang and 39659 others unlocked
CSC108H1 Full Course Notes
21
CSC108H1 Full Course Notes
Verified Note
21 documents

Document Summary

Non-ascending order. (means descending, except when there"s a tie) The property we"re sorting (keys) are independent of the algorithm of the sort. Can sort by age, height, etc but the order is the algorithm. Select it and switch it with the first object in the list. Start from the unsorted object and search for the next tallest object, select the object and swap it with the first object that isn"t sorted and move the fence. On each major pass of the data: select the next item from unsorted side ( next = tallest, fattest, shortest, etc, swap that selected item with 1st item in unsorted side, move fence. It"s true that the first object on the sorted side is the tallest object. All the stuff on the sorted side are taller than the objects on unsorted side. Items on sorted side of the fence are in their final spot.

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