摘要: #pragma once #include /*合并两个已经排序好的子序列 两个已经排序好的子序列为src[startIndex]-src[middleIndex];src[middleIndex+1]-src[endIndex] */ template void Merge(T *src, int startIndex, int middleIndex, int endIndex) { in... 阅读全文
posted @ 2016-04-24 12:12 ql698214 阅读(177) 评论(0) 推荐(0) 编辑
摘要: #pragma once /* 插入排序算法,相当于抓牌时,手里的牌都是已经排序好的,新抓起的牌从右向左依次和手里的牌进行比较 每比较依次都要后移一位多出一个空位,以便新牌插入到正确的位置 */ template void InsertSort(T *src, int length) { for (int j = 1; j = 0 && key < src[i]) { //待插入的牌小于手中... 阅读全文
posted @ 2016-04-24 12:11 ql698214 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 求各种数据类型所占用的字节数可调用sizeof函数,求各种数据类型的最大值可以调用limits标准库中的numeric_limits::max(),numeric_limits::min()函数 #include #include #include using namespace std; int main() { cout ::max)(); cout ::min)() ... 阅读全文
posted @ 2016-04-24 10:32 ql698214 阅读(1336) 评论(0) 推荐(0) 编辑