C#快速排序源码演示
如下的资料是关于C#快速排序演示的代码,应该对各位朋友有用处。
private static int Partition (int[] list, int i, int j){ int Key = list [i]; while (i < j) { while (list [j] >= Key && i < j) j--; if(i< j) list [i++] = list [j]; while (list [i] <= Key && i < j) i++; IF (i < j) list [j--] = list[i]; } list [i] = Key; return i;}public static void QuickSort (int[] list, int low, int high){ if(low < high - 1) { int Key = Partition (list, low, high); QuickSort (list, low, Key - 1); QuickSort (list, Key + 1, high); }}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。