摘要:
一:折半查找: public int rank(int key, int[] arr){ // 要求数组是有序的 int min = 0; int max = arr.Length - 1; while(min <= max){ // 被查找的内容要么不在要么在arr[min ,,,, max]之中
阅读全文
摘要:
using System; namespace Algorithm.AFind { public class Example04:IComMethod { int[] a1 = { 8, 9, 7, 5, 4, 3, 10, 12, 1, 2, 21, 66, 43}; public Example
阅读全文
摘要:
目标:对数组(列表等任意有序容器)进行排序 方法:对列表进行遍历,选出最大的 之后将这个数储存起来,对剩下的数再选择最大的,之后再对剩下数做同样的操作 直至结束即可。 代码如下: public class Example02:IComMethod { public Example02() { } p
阅读全文