数据结构
文章平均质量分 77
xiaoniba10631
软件工程专业 大一学生
展开
-
二叉树的前序遍历 非递归的几种方法
第一种: template void BinaryTree::PreOrderWithoutRecusion (BinaryTreeNode* root) //非递归前序遍历二叉树或其子树 { using std::stack; //使用STL中的stack stac原创 2011-08-24 20:28:20 · 444 阅读 · 0 评论 -
数据结构 栈源代码
#include #include using namespace std; #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 typedef int SElemType; typedef struct{ SE原创 2011-08-22 15:21:39 · 802 阅读 · 0 评论 -
数据结构 循环队列 顺序表实现
1. 当队尾插入元素时,Q.rear++;弹出元素时,Q.front++; 2.当队列满时,Q.rear的下一个元素是Q.front; #include using namespace std; #define MAXQSIZE 100 typedef int Q原创 2011-08-22 20:45:26 · 1146 阅读 · 0 评论 -
数据结构 队列源代码
#include #include using namespace std; typedef int SElemType; struct Node { SElemType data; struct Node* next; }; typedef原创 2011-08-22 17:57:28 · 1697 阅读 · 0 评论 -
函数返回值是指针的引用 函数形参是引用
马上要找工作了,复习数据结构的二叉树!所以实现一下,但是在创建二叉树时遇到了一些问题! tree.h #ifndef _TREE_H #define _TREE_H #include #include #include using namespace std;原创 2011-08-24 15:49:38 · 1584 阅读 · 0 评论 -
最小堆 c++源代码
#ifndef _MINHEAP_H #define _MINHEAP_H template class MinHeap //最小堆ADT定义 { private: T* heapArray; //存放堆数据的数组 int CurrentSize;原创 2011-08-26 09:53:31 · 2379 阅读 · 1 评论 -
前序遍历二叉树 中序遍历二叉树 后序遍历二叉树 c++ STL 模板
//前序周游二叉树或其子树 template void BinaryTree::PreOrder(BinaryTreeNode* root) { stack* > aStack; BinaryTreeNode* pointer=root; while(!aStack.emp原创 2011-08-24 20:45:58 · 871 阅读 · 0 评论 -
STL priority_queue c++用法
priority_queue 调用 STL里面的 make_heap(), pop_heap(), push_heap() 算法 实现,也算是堆的另外一种形式。 先写一个用 STL 里面堆算法实现的与真正的STL里面的 priority_queue 用法相 似的 pr转载 2011-08-28 08:58:00 · 693 阅读 · 0 评论