⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 binsearchmain1.cpp

📁 二叉搜索树的基本操作
💻 CPP
字号:
#include <iostream.h>
#include <stdlib.h>
#include"binSearchTree1.h"

void main()
{
	ElemType a[10] ={ 30,50,20,70,25,54,80,23,92,40};
	BSTNode* bst =NULL;
	ElemType x=70;
	CreateBSTree(bst,a,10);
	cout<<"建立的二叉搜索树的广义表形式为:"<<endl;
	PrintBSTree(bst);cout<<endl;
	cout<<"中序遍历:"<<endl;
	Inorder(bst);
	cout<<endl;
    if(Find(bst,x))
		cout<<"查找成功!得到的x为:"<<x<<endl;
	else
		cout<<"查找失败!"<<endl;
	Insert(bst,36);
	Delete(bst,30);
	Delete(bst,70);
	Delete(bst,40);
	cout<<"操作后的中序遍历为"<<endl;
	Inorder(bst);
	cout<<endl;
    cout<<"操作后的二叉搜索树的广义表形式为:"<<endl;
	PrintBSTree(bst);cout<<endl;
    ClearBSTree(bst);
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -