码迷,mamicode.com
首页 > 其他好文 > 详细

[2012] 数组题(2)

时间:2014-06-27 18:47:59      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:style   color   c   一个   size   第一个   

     给定一个数组input[] ,如果数组长度n为奇数,则将数组中最大的元素放到 output[] 数组最中间的位置,如果数组长度n为偶数,则将数组中最大的元素放到 output[] 数组中间两个位置偏右的那个位置上,然后再按从大到小的顺序,依次在第一个位置的两边,按照一左一右的顺序,依次存放剩下的数。
      例如:input[] = {3, 6, 1, 9, 7}   output[] = {3, 7, 9, 6, 1};             input[] = {3, 6, 1, 9, 7, 8}    output[] = {1, 6, 8, 9, 7, 3}
     函数接口   void sort(int input[[, int n, int output[])

[2012] 数组题(2),布布扣,bubuko.com

[2012] 数组题(2)

标签:style   color   c   一个   size   第一个   

原文地址:http://www.cnblogs.com/Xylophone/p/3809700.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!