摘要: 今天看c#plus 中的一个比较冒泡排序与 System.Array.Sort() 性能,发现System.Arry.Sort()的性能要远远的优于冒泡排序,下面代码大家有兴趣可以看一下: 阅读全文
posted @ 2008-01-28 02:12 Forrest Gump 阅读(1047) 评论(2) 推荐(0) 编辑
摘要: 堆排序是一树形选择排序,在排序过程中,将R[1..N]看成是一颗完全二叉树的顺序存储结构,利用完全二叉树中双亲结点和孩子结点之间的内在关系来选择最小的元素。 阅读全文
posted @ 2008-01-28 01:23 Forrest Gump 阅读(1385) 评论(2) 推荐(0) 编辑
摘要: 基于分治思想的合并排序,算法导论中的思考题,不加哨兵牌(sentinel card)的实现方式,实现很简单 阅读全文
posted @ 2008-01-28 01:18 Forrest Gump 阅读(1375) 评论(0) 推荐(0) 编辑
摘要: using System; public class ShellSorter { public void Sort(int [] list) { int inc; for(inc=1;inc0;inc/=3) { for(int i=inc+1;iinc)&&(list[j-inc-1]>t)) { list[j-1]=list[j-inc-1]; j-=inc; } ... 阅读全文
posted @ 2008-01-28 01:09 Forrest Gump 阅读(504) 评论(0) 推荐(0) 编辑
摘要: 1using System; 2namespace MyQSort{ 3 public class QSort //可以写成static public class QSort 4 { 5 private static int[] toBeSort; 6 private static void swap(int a,int b){ 7 int c; 8 c=toBeS... 阅读全文
posted @ 2008-01-28 01:04 Forrest Gump 阅读(259) 评论(0) 推荐(0) 编辑