View
212
Download
0
Category
Preview:
Citation preview
APS105
Sorting
Sorting
• Sorting is a commonly needed function– itunes can sort your song library different ways– excel spreadsheet can sort a column of numbers– phone book is sorted by last name
• Many different sorting algorithms– some are simple, some are complex– some are fast, some are slow
• How would you sort this array of ints?
List: 9 5 22 8 5 2 14 3 22 4 7
Code for Insertion Sort.
Dance
Code for Bubble Sort.
Dance
Recursive Cake Cutting Sort?
.
List: 9 5 22 8 5 2 14 3 24 4
List:
Recursive Cake Cutting Sort?
List: 9 5 22 8 5 2 14 3 24 4
List:
List:
List:
Quick Sort (like recursive cake cutting)
.
List: 9 5 22 8 4 3Pivot:
Gif
Code for Quick Sort.
Quick Sort with Helper
.
RobotsDanceSorting Algs Obama
Recommended