当前位置: 代码迷 >> C语言 >> [求助] heap sort 排序算法(堆排序) problem
  详细解决方案

[求助] heap sort 排序算法(堆排序) problem

热度:755   发布时间:2006-10-31 22:09:26.0
[求助] heap sort 排序算法(堆排序) problem

Is anyone know how to do this program? This program need to print all the stage, but only print the number. For example, stage 1- only print 4 1 3 2 16 9 10 14 8 7

input> 4 1 3 2 16 9 10 14 8 7
stage1: 4 1 3 2 16 9 10 14 8 7
stage 2: 4 1 3 2 16 * 9 10 14 8 7
stage 3: 4 1 3 2 * 16 9 10 14 8 7
stage 4: 4 1 3 * 14 16 9 10 2 8 7
stage 5: 4 1 * 10 14 16 9 3 2 8 7
stage 6: 4 * 16 10 14 7 9 3 2 8 1
stage 7: 16 14 10 8 7 9 3 2 4 1
stage 8: 14 8 10 4 7 9 3 2 1 * 16
stage 9: 10 8 9 4 7 1 3 2 * 14 16
stage 10: 9 8 3 4 7 1 2 * 10 14 16
stage 11: 8 7 3 4 2 1 * 9 10 14 16
stage 12: 7 4 3 1 2 * 8 9 10 14 16
stage 13: 4 2 3 1 * 7 8 9 10 14 16
stage 14: 3 2 1 * 4 7 8 9 10 14 16
stage 15: 2 1 * 3 4 7 8 9 10 14 16
stage 16: 1 * 2 3 4 7 8 9 10 14 16
Final stage 17: 1 2 3 4 7 8 9 10 14 16

Thank you

搜索更多相关的解决方案: heap  sort  problem  算法  

----------------解决方案--------------------------------------------------------
呵呵 俺也想知道这个问题

----------------解决方案--------------------------------------------------------

用goto,这是我只能想到的了,高手指教


----------------解决方案--------------------------------------------------------
纯不懂.
我也想知道.
----------------解决方案--------------------------------------------------------
看数据结构的书吧,上面有堆排序的~
我在公司~不方便写代码~
----------------解决方案--------------------------------------------------------
  相关解决方案