随笔分类 -  数据结构

插入排序(C#)
摘要:usingSystem;publicclassInsertionSorter{publicvoidSort(int[]list){for(inti=1;i<list.Length;++i){intt=list[i];intj=i;while((j>0)&&(list[j-1]>t)){list[j]=list[j-1];--j;}list[j]=t;}}}publ... 阅读全文

posted @ 2006-03-04 16:38 阿伟 阅读(386) 评论(1) 推荐(0)

快速排序(c#)
摘要:usingSystem;namespaceQuickSorter{publicclassQuickSorter{privatevoidSwap(refintl,refintr){ints;s=l;l=r;r=s;}publicvoidSort(int[]list,intlow,inthigh){intpivot;intl,r;intmid;if(high<=low)return;elseif... 阅读全文

posted @ 2006-03-04 13:58 阿伟 阅读(859) 评论(0) 推荐(0)

选择排序(C#)
摘要:sing System;public class SelectionSorter{ // public enum comp {COMP_LESS,COMP_EQUAL,COMP_GRTR}; private int min; // private int m=0; public void Sort(int [] list) { for(int i=0;i<list.Len... 阅读全文

posted @ 2006-03-01 11:20 阿伟 阅读(309) 评论(0) 推荐(0)

导航