摘要: 下面代码仅供本人复习数据结构所用,实用性N低,各位飘过吧~~哈哈:>//// C++ 模版技术实现堆排序. // #include <cstdlib>#include <cstring> #include <iostream>#include <stdexcept>//// 堆化函数模版.// 当一棵二叉树除了根节点外,其子树都满足堆性质时,// 对根节点进行调整,使得整棵二叉树树都满足堆性质.//template <typename T>void heapify(T *array, size_t low, const size 阅读全文
posted @ 2011-05-28 23:53 Atypiape 阅读(643) 评论(0) 推荐(0) 编辑
摘要: 下面代码仅供本人复习数据结构所用,实用性N低,各位飘过吧~~哈哈:> 阅读全文
posted @ 2011-05-28 20:00 Atypiape 阅读(1292) 评论(0) 推荐(0) 编辑
摘要: 下面代码仅供本人复习数据结构所用,实用性N低,各位飘过吧~~哈哈:>//// C++模版技术实现快速排序. // #include <cstdlib>#include <cstring>#include <iostream> #include <stdexcept>//// 两值交换. //template <typename T>inline void swap(T &x, T &y){ T temp = x; x = y; y = temp;} //// 快速排序函数模版. // 以首元素为基准(pivot) 阅读全文
posted @ 2011-05-28 17:04 Atypiape 阅读(698) 评论(0) 推荐(0) 编辑
摘要: 下面代码仅供本人复习数据结构所用,实用性N低,各位飘过吧~~哈哈:>//// C++ 模版技术实现归并排序. // #include <cstdlib>#include <cstring> #include <iostream>#include <stdexcept>//// 归并操作. //template <typename T> void merge(T *array, const size_t low, const size_t mid, const size_t high){ if (NULL == array) { 阅读全文
posted @ 2011-05-28 15:17 Atypiape 阅读(2181) 评论(0) 推荐(0) 编辑
摘要: 下面代码仅供本人复习数据结构所用,实用性N低,各位飘过吧~~哈哈:>//// C++ 模版技术实现直接插入排序. // #include <cstdlib>#include <cstring> #include <iostream>template <typename T>void insertionSort(T *array, const size_t count){ T temp; for (size_t i = 1, j; i < count; ++i) { for (j = i, temp = array[j]; 0 < 阅读全文
posted @ 2011-05-28 00:09 Atypiape 阅读(976) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示