摘要:
#include #include using namespace std; template class MinHeap{ private: T *heapArray; int CurrentSize; int MaxSize; void swap(int pos_x,int pos_y) //交换 { T temp; ... 阅读全文
摘要:
代码是根据之前的二叉树模板修改来的,删去了非递归遍历,加入二叉搜索树的搜索、插入和删除,实现方法在73~153行 阅读全文
摘要:
#include<iostream>using namespace std;template <class T>class CompleteBinaryTree{ //完全二叉树,所有结点从0~n-1编号 //对于结点i,它的左右子树分别位于2i+1和2i+2,它的父结点为[(i-1)/2] //除 阅读全文
摘要:
#include #include #include using namespace std; template class BinaryTree; template class BinaryTreeNode { friend class BinaryTree; private: T data; //二叉树数据域 BinaryTreeNode *leftchild; ... 阅读全文