Exercises
Explanation:
The correct answer is: 17 34 50 51 81 94 98 80 78 96
Here is the array after each exchange:
94 98 96 50 81 17 34 80 78 51
1: 17 98 96 50 81 94 34 80 78 51
2: 17 34 96 50 81 94 98 80 78 51
3: 17 34 50 96 81 94 98 80 78 51
4: 17 34 50 51 81 94 98 80 78 96
Explanation:
The correct answer is: 0 3 2 1 2 3 1 4
0: Original input
3: Shellsort after 4-sorting
2: Selection sort after 8 iterations
1: Insertion sort after 8 iterations
2: Selection sort after 7 iterations
3: Shellsort after 13-sorting
1: Insertion sort after 5 iterations
4: Sorted