- 3
- 0
- 约1.08万字
- 约 54页
- 2019-10-13 发布于山东
- 举报
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Algorithms Design Techniques and Analysis Algorithm 1.6 BOTTOMUPSORT Input: 包含n个元素的数组 A [1..n] Output: A [1..n] 按照非递减排序. 1. t?1 2.while tn 3. s ?t; t?2s; i?0 4. while i + t ? n 5. MERGE(A, i+1, i + s, i+t) 6. i?i+t 7. end while 8. if i + s n then MERGE(A, i+1, i + s, n) 9.end while Algorithms Design Techniques and Analysis An example A[1..11] = 6,10,9,5,3,11,4,8,1,2,7 6 10 9 5 3 11 4 8 1 2 7 6 10 5 9 3 11 4 8 1 2 7 5 6 9 10 3 4 8 11 1 2 7 3 4 5 6 8 9 10 11 1
原创力文档

文档评论(0)