6 1 是否二叉搜索树 (25 分) 本题要求实现函数,判断给定二叉树是否二叉搜索树。 函数接口定义: bool IsBST ( BinTree T ); 其中BinTree结构定义如下: typedef struct TNode Position; typedef Position BinTree ...
分类:
其他好文 时间:
2019-05-15 00:28:22
阅读次数:
164
1 BinTree Insert( BinTree BST, ElementType X ) 2 { 3 if (BST==NULL) { 4 BinTree tmp=(BinTree)malloc(sizeof(struct TNode)); 5 tmp->Data=X; 6 tmp->Left=... ...
分类:
其他好文 时间:
2018-12-06 22:22:15
阅读次数:
279
1 int GetHeight(BinTree BT) 2 { 3 int HL, HR, MaxH; 4 5 if(BT) 6 { 7 HL = GetHeight(BT->Left); //求左子树的高度 8 HR = GetHeight(BT->Right); //求右子树的高度 ... ...
分类:
其他好文 时间:
2018-09-30 12:43:44
阅读次数:
179
#ifndef BST_hpp #define BST_hpp #include "BinTree.hpp" #include "Entry.hpp" //二叉搜索树 //任何一个二叉树是二叉搜索树,当且仅当其中序遍历序列单调非降 template class BST : public BinTre... ...
分类:
其他好文 时间:
2018-09-10 17:59:38
阅读次数:
123
BinNode.hpp BinTree.hpp ...
分类:
其他好文 时间:
2018-09-10 17:55:54
阅读次数:
108
本题要求实现给定二叉搜索树的5种常用操作。 函数接口定义: BinTree Insert( BinTree BST, ElementType X ); BinTree Delete( BinTree BST, ElementType X ); Position Find( BinTree BST, ...
分类:
其他好文 时间:
2018-07-03 01:00:35
阅读次数:
185
本题要求实现给定二叉搜索树的5种常用操作。 函数接口定义: 其中BinTree结构定义如下: 函数Insert将X插入二叉搜索树BST并返回结果树的根结点指针; 函数Delete将X从二叉搜索树BST中删除,并返回结果树的根结点指针;如果X不在树中,则打印一行Not Found并返回原树的根结点指针 ...
分类:
其他好文 时间:
2018-04-06 15:29:08
阅读次数:
133
二叉树的定义 类型名称:二叉树 数据对象集:一个有穷的结点集合。若不为空,则有根结点和其左、右二叉子树组成。 操作集:BT∈BinTree, Item∈ElementType,重要操作有: 1、Boolean IsEmpty(BinTree BT):判别BT是否为空 2、void Traversal ...
分类:
其他好文 时间:
2018-04-05 14:34:36
阅读次数:
201
在做数据结构慕课《03-树3 Tree Traversals Again》这道题时,我的思路是先构造好树,而后直接用PostOrderTraversal(BinTree BT)进行后序遍历。(这道题目前暂未ac,整体方法有待完善)课上所讲的后序遍历递归实现方法是这样的—— 不过这样一来就有问题,题目 ...
分类:
其他好文 时间:
2018-03-21 11:37:14
阅读次数:
100
6-12 二叉搜索树的操作集(30 分) 本题要求实现给定二叉搜索树的5种常用操作。 函数接口定义: BinTree Insert( BinTree BST, ElementType X ); BinTree Delete( BinTree BST, ElementType X ); Positio ...
分类:
其他好文 时间:
2018-02-01 22:10:37
阅读次数:
176