程序填空题:Shellsort Runs
Show the result of running Shellsort on the input 9, 8, 7, 6, 5, 4, 3, 2, 1 using the increments {1, 3, 7}. Please fill in the blanks in the table.
Note: There must be one space between a pair of adjacent numbers, but no extra space at the beginning or the end of the line.
|Original| 9 8 7 6 5 4 3 2 1 |
|:------:|:-----------------|
|After 7-sort|@@[2 1 7 6 5 4 3 9 8](1)|
|After 3-sort|@@[2 1 4 3 5 7 6 9 8](1)|
|After 1-sort| 1 2 3 4 5 6 7 8 9 |
答案:
第1空:2 1 7 6 5 4 3 9 8
第2空:2 1 4 3 5 7 6 9 8
Note: There must be one space between a pair of adjacent numbers, but no extra space at the beginning or the end of the line.
|Original| 9 8 7 6 5 4 3 2 1 |
|:------:|:-----------------|
|After 7-sort|@@[2 1 7 6 5 4 3 9 8](1)|
|After 3-sort|@@[2 1 4 3 5 7 6 9 8](1)|
|After 1-sort| 1 2 3 4 5 6 7 8 9 |
答案:
第1空:2 1 7 6 5 4 3 9 8
第2空:2 1 4 3 5 7 6 9 8