Eogene

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2012年2月8日

摘要: #include "排序算法.h"排序算法::排序算法(void){}排序算法::~排序算法(void){}/*交换排序: 包括冒泡排序,快速排序。插入排序: 包括直接插入排序,希尔排序。选择排序: 包括直接选择排序,堆排序。合并排序: 归并排序。*/template<class T>void Swap(T list[],int l,int r){ T *temp = list + l; list[l] = list[r]; list[r] = *temp;}//************************************************** 阅读全文
posted @ 2012-02-08 11:33 EoGene 阅读(336) 评论(0) 推荐(0) 编辑

摘要: //***********************************顺序查找算法 排列从low-high的序列 平均查找长度:ASL = (n+1)/2template<class T>int SeqSearch(T list[],int count,T key){ int i; for(i=count ; list[i] == key ; i--); return i;}//***********************************折半查找template<class T>int BinSearch(T list[],int count,T key) 阅读全文
posted @ 2012-02-08 10:33 EoGene 阅读(1187) 评论(0) 推荐(0) 编辑