bst.cpp

来自「算法设计的动态规划中的最优二叉搜索树问题」· C++ 代码 · 共 30 行

CPP
30
字号
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include"tnode.h"
typedef char DataType;
#include "bstree.h"
#include "print.h"
#include "iostream.h"
void main(void)
{
	int i;
	char test[50];
	BSTree T;
	SetBST(&T);
	//clrscr();
	cout<<"input data"<<endl;
	gets(test);
	for(i=0;test[i]!='\0';i++)
		BSTInsert(&T,test[i]);
	//clrscr();
	PrintTree(GetRoot(&T),80);
	cout<<"Press any key and delete"<<endl;
	getch();
	BSTDelete(&T,'D');
    //clrscr();
	PrintTree(GetRoot(&T),80);
	getch();
	FreeBST(&T);
}

⌨️ 快捷键说明

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