c#快排算法
来源:互联网 发布:软件功能设计图 编辑:程序博客网 时间:2024/04/18 12:19
//这个是我测试了的快排算法,中间值只能放到后面的分区去做,最主要的就一分区,然后递归了/// /// QueckSort类 /// public class QueckSort { private void swap(ref int a, ref int b) { int temp = a; a = b; b = temp; } private int partion(int[] array, int low, int high) { int standValue = array[high]; int i = low; int j = low - 1; for (; i < high; i++) { if (array[i]<=standValue) { j++; if (i!=j) { swap(ref array[i], ref array[j]); } } } swap(ref array[j + 1],ref array[high]); return j; } public void Sort(int[] array, int low, int high) { if (low<high) { int middleIndex = partion(array, low, high); Sort(array, low, middleIndex); Sort(array, middleIndex +1, high); } } }
0 0
- c#快排算法
- 算法----快排算法
- 快排算法
- 快排算法
- 快排算法
- 快排算法cmp
- 快排算法
- 算法导论--->快排
- 排序算法--快排
- 快排算法quickSort
- 快排算法
- 随机快排算法
- [算法]快排
- 算法 排序 快排
- 快排算法
- 大话算法-快排
- 算法-快排
- 快排算法
- 杭电1257 最少拦截系统
- How can I install mySQL on CentOS without being root/su?
- Light OJ 1214 - Large Division 【同余定理】
- 杭电1159Common Subsequence
- 清晰理解Objective-C元类
- c#快排算法
- 最长递增子序列问题
- 小写数字转换成大写&&&&facebook时间戳格式
- 哈理工1116选美大赛(最长递增子序列)(对dp数组内数据的理解)
- Java中的Default方法
- B2C网上书城需求分析设计文档(上)
- 极光推送—自定义消息
- Spring + Mvc + Mybatis 框架例子
- 毕业设计 贪吃蛇 注释+源代码 我的java学习之路