#include typedef struct BinTree{ int data; struct BinTree *left; struct BinTree *right;}BinTree;void PreOrder(BinTree *root){ if(root == NULL) return....
分类:
其他好文 时间:
2015-08-11 18:37:20
阅读次数:
105
#include
#include
typedef struct TreeNode *BinTree; //定义一个对象指针
typedef BinTree Position; //定义一个对象指针名
struct TreeNode{
int Data;
BinTree Left;
BinTree Right;
};
//二叉搜索数的查找Find
Positi...
分类:
编程语言 时间:
2015-07-21 18:48:44
阅读次数:
131
C实现二叉树模块化集成实验源码介绍(源代码的总体介绍):header.h : 头文件链栈,循环队列,二叉树的结构声明和相关函数的声明。LinkStack.c : 链栈的相关操作函数定义。Queue.c : 循环队列的相关操作函数定义。BinTree.c : 二叉树的相关操作的函数定义,层序序列生成二...
分类:
其他好文 时间:
2015-07-09 11:08:12
阅读次数:
114
创建先序二叉树#include<iostream>
usingnamespacestd;
classBinTreeNode
{
public:
charch;
BinTreeNode(intvalue){ch=value;}
BinTreeNode*left,*right;
};
BinTreeNode*create_tree()
{
charitem;
BinTreeNode*t,*t_l,*t_r;
cin>>item;
if(item!=‘#‘)
{
BinTree..
分类:
其他好文 时间:
2015-07-05 16:56:38
阅读次数:
123
#include#includeusing namespace std;/*二叉树的前序遍历,按照 根节点->左孩子->右孩子*/typedef struct node{ char data; struct node *lchild,*rchild;}BinTree;void crea...
分类:
其他好文 时间:
2015-06-24 20:59:48
阅读次数:
123
#ifndef BINTREE_H_INCLUDED
#define BINTREE_H_INCLUDED
#include
#include
#include
#include
using namespace std;
template
class BinTree;
template
class BinTreeNode
{
public:
friend class BinT...
分类:
其他好文 时间:
2015-06-19 15:25:51
阅读次数:
139
//实现二叉树以及其基本操作
//头文件
#include
using namespace std;
template
class Bintree;
template
class BintreeNode
{
friend class Bintree;
public:
BintreeNode() :data(Type()), leftchild(NULL), rightchild(N...
分类:
其他好文 时间:
2015-06-09 11:50:48
阅读次数:
95
头文件:
#include
using namespace std;
template
class Bintree;
//结点类
template
class BintreeNode
{
friend class Bintree;
public:
BintreeNode() :data(Type()), leftchild(NULL), rightchild(NULL)
{}...
分类:
编程语言 时间:
2015-06-09 09:56:05
阅读次数:
103
构造析构: BinTree() : _size(0), _root(NULL) { } //构造函数
~BinTree() { if (0 < _size) remove(_root); } //析构函数插入: BinNodePosi(T) insertAsRoot(T const & e); //插入根节点
BinNodePosi(T) insertAsLC(BinNodePo...
分类:
其他好文 时间:
2015-06-01 18:57:35
阅读次数:
93
二叉树结点定义:#define BinNodePosi(T) BinNode* //节点位置
#define stature(p) ((p) ? (p)->height : -1) //节点高度(与“空树高度为-1”的约定相统一)
typedef enum { RB_RED, RB_BLACK} RBColor; //节点颜色template struct BinNo...
分类:
其他好文 时间:
2015-05-31 14:02:24
阅读次数:
205