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

📄 emp5_16.cpp

📁 该包是数据结构的实验软件,来源于合肥工业大学人工智能与数据挖掘实验室,用来实现数据结构.
💻 CPP
字号:
// emp5_16 
#include "btrechar.h"

bptrlink ptr;
int n,n1;
void nodes1(bitre t)
{
	int n1;
	if (t==NULL)  n=0;
	else{
		nodes1(t->lchild);
		n1=n;
		nodes1(t->rchild);
		n=n+1+n1;
		bptr_point_to(ptr, t);
		getch();
		dispint_atbnode_angle(n,t,0);
	}
}

void nodes2(bitre t)
{
	if (t==NULL)  n=0;        //{ Wrong }
	else{
		nodes2(t->lchild);
		n1=n;
		n=n+1+n1;
		bptr_point_to(ptr, t);
		getch();
		dispint_atbnode_angle(n,t,0);
		nodes2(t->rchild);
	}
}

void nodes3(bitre t)
{
	if (t==NULL)      ;   //n=0;         //{ Correct }
	else{
		nodes3(t->lchild);
		n=n+1;
		bptr_point_to(ptr,t);
		getch();
		dispint_atbnode_angle(n,t,0);
		nodes3(t->rchild);
	}
}

void main()
{
	bitre t;
	int k;
		initial_bitre();
	load_bitre_file(t,"bitres\\full42.cbt");
	comput_bitre_card(t);
	window(1,1,80,4);
	create_bptr(ptr, "T");
	disp_bitre("Preorder",t);
	n=0;
	nodes1(t);
	printf("nodes1=%d\n",n);
	disp_bitre("Preorder",t);
	n=0;
	nodes2(t);
	printf("nodes2=%d\n",n);
	disp_bitre("Preorder",t);
	n=0;
	nodes3(t);
	printf("nodes3=%d\n",n);
	getch();
}

⌨️ 快捷键说明

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