码迷,mamicode.com
首页 > 编程语言 > 详细

使用直接排序法对一维数组进行排序

时间:2018-12-04 14:47:03      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:.com   turn   ret   int   pre   图片   str   原理   return   

实现效果:

  技术分享图片

实现原理:

  技术分享图片

实现代码:

        public int[] sory(int[] intArray)
        {
            for (int i = 0; i < intArray.Length;i++ )
            {
                int j = i;
                int temp = intArray[i];
                while((j>0)&&temp>(intArray[j-1])){
                    intArray[j] = intArray[j - 1];
                    j--;
                }
                intArray[j] = temp;
            }
            return intArray;
        }

  

 

使用直接排序法对一维数组进行排序

标签:.com   turn   ret   int   pre   图片   str   原理   return   

原文地址:https://www.cnblogs.com/feiyucha/p/10063562.html

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