#include<iostream.h>
#include<stdlib.h>
#include"binSearchTRee1.h"
void InitBSTree(BSTNode*&BST)
{
BST=NULL;
}
bool BSTreeEmpty(BSTNode* BST)
{
return BST==NULL;
}
bool Find(BSTNode* BST,ElemType& item)
{
if(BST==NULL)return false;
else{
if(item==BST->data)
item=BST->data;
return ture;
}
else if(item<BST->data)
return Find(BST->left,item);
else
return Find(BST->right,item);
}
}
bool Update(BSTNode* BST,const ElemType& item)
{
if(BST==NULL)return false;
else{
if(item==BST->data){
BST->data=item;
return ture;
}
else if(item<BST->data)
return Update(BST->left,item);
else
return Update(BST->right,item);
}
}
vodi Insert(BSTNode*&BST,const Elemtype& item)
{
if(BST==NULL)
{
BSTNode* p=new BSTNode;
p->data=item;
p->left=p->right=NULL;
BST=p;
}
else if(item<BST->data)
Insert(BST->left,item);
else
Insert(BST->right,item);
}
bool
二叉搜索树用C++编写的一个程序
5星 · 超过95%的资源 需积分: 9 43 浏览量
2009-01-08
22:53:42
上传
评论
收藏 6KB RAR 举报
qxs239
- 粉丝: 0
- 资源: 2
最新资源
- tensorflow-2.6.2-cp38-cp38-manylinux2010-x86-64.whl
- tensorflow-2.6.2-cp37-cp37m-win-amd64.whl
- RV180-Firmware-1.0.5.4.img
- 粒子群算法.docx 粒子群算法(Particle Swarm Optimization,PSO)是一种优化算法,受到鸟群或鱼
- asp代码ASP基于WEB楼宇专业网站毕业设计(源代码+论文)
- 九宫重排.docx 验证重排后的九宫格是否满足所有条件,包括每行、每列和每个子区域的目标和值相等,以及是否包含1到9的所有数字
- asp代码ASP基于WEB聊天室的设计与实现(源代码+论文+任务书)
- 质数的判断条件.docx
- android-ocr-master,android-ocr-master
- asp代码ASP基于WEB教学评估系统设计(源代码+论文)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈