2006年3月4日

插入排序(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 阿伟 阅读(378) 评论(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 阿伟 阅读(855) 评论(0) 推荐(0) 编辑

导航