Professional Documents
Culture Documents
10 Activity 1
10 Activity 1
1. Bubble Sort (21, 4, 25, 16) - Every pair of adjacent items is compared, and items are swapped until they are in order
21 4 25 16 4 21 25 16
4 21 25 16 4 21 25 16
4 21 25 16 4 21 16 25
4 21 16 25 4 21 16 25
4 21 16 25 4 16 21 25
2. Selection Sor (21, 4, 25, 16, 12, 17) - The smallest unsorted item is chosen and then swapped with the item in the next position
to be filled
21 4 25 16 12 17 4 21 25 16 12 17
4 21 25 16 12 17 4 12 25 16 21 17
4 12 25 16 21 17 4 12 16 25 21 17
4 12 16 25 21 17 4 12 16 17 21 25
3. Insertion Sort (21, 4, 25, 16, 12) - The comparison applies to adjacent items and previously scanned items
21 4 25 16 12 4 21 25 16 12
4 21 25 16 12 4 21 25 16 12
4 21 25 16 12 4 21 16 25 12
4 16 21 25 12
4 16 21 25 12
4 16 21 25 12
4 16 21 25 12 4 16 21 12 25
4 16 21 12 25
4 16 12 21 25
4 16 12 21 25 4 12 16 21 25
4. Shell Sort (21, 4, 25, 16, 12, 17) - Items at a specific interval are sorted. The interval between the items is gradually decreasing
based on a sequence.
21 4 25 16 12 17
21 16 16 21
4 12 4 12
https://www.coursehero.com/file/125750010/10-Activity-1docx/
IT1815
25 17 17 25
16 4 17 21 12 25 4 16 17 21 12 25
4 16 17 21 12 25 4 16 17 21 12 25
4 16 17 21 12 25 4 16 17 21 12 25
4 16 17 21 12 25 4 16 17 12 21 25
4 16 17 12 21 25 4 16 17 12 21 25
4 16 17 12 21 25
4 16 17 12 21 25
4 16 12 17 21 25
4 12 16 17 21 25
5. Merge Sort (21, 4, 25, 16, 12, 17, 3, 30) - The list is divided into sorted sub-lists then combined into a single sorted list.
https://www.coursehero.com/file/125750010/10-Activity-1docx/
Powered by TCPDF (www.tcpdf.org)