2013年3月6日

5个数6次比较找中位数,7次比较排序 [转]

摘要: [转]http://blog.csdn.net/myscnu/article/details/43236471 int compare6(int a,int b,int c,int d,int e){2 if(a<b)swap(a,b);3 if(c<d)swap(c,d);4 if(a<c){swap(a,c);swap(b,d);}5 if(b<e)swap(b,e);6 if(b<c){swap(b,c);swap(d,e);}7 if(e<c) return c;8 else return e;9 }7次比较排序:见http://... 阅读全文

posted @ 2013-03-06 19:46 龙豆 阅读(537) 评论(0) 推荐(0) 编辑

导航