摘要:
#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;}//************************************************** 阅读全文
摘要:
//***********************************顺序查找算法 排列从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) 阅读全文