• Quick sort C# code


    public class IntQuickSort
    {
            private static int Split(int[] data,int low,int high)
           {
                 if(data == null) throw new ArgumentException();
                 if(low<0 || high >= data.length) throw new ArgumentOutOfRangeException();

                 int pivot= data[low];
                 while(low<high)
                 {
                        while(low<high && data[high] >= pivot) high--;
                        data[low] = data[high];
                        while(low<high && data[low] <= pivot) low++;
                        data[high] = data[low];
                  }
                  data[low] = pivot;
                  return low;
            }

            //recursion quick sort
            public static void QuickSort(int[] data,int low,int high)
           {
                int pivot= Split(data,low,high);
                QuickSort(data,low,pivot-1);
                QuickSort(data,pivot+1,high);
            }
           
    }

  • 相关阅读:
    xp_cmdshell
    常用SQL语句
    SQL Server Select的递归查询-交叉表
    Sql Server 2005 行转列的实现(横排)
    sql导入导出
    使用正则表达式验证手机号、车牌号
    页面功能:设为首页和加入收藏
    两个文本框同步输入
    最常用的200个JS代码
    .NET 获取时间
  • 原文地址:https://www.cnblogs.com/stone/p/1232343.html
Copyright © 2020-2023  润新知