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

📄 bitree.cpp

📁 二叉树
💻 CPP
字号:
// bitree.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "tree.h"

#define SIZE 12

int main(int argc, char* argv[])
{
	CTree tree;
	tree.m_pRoot=new CTreeNode[SIZE];
	tree.m_pRoot[0].m_pLeft=&tree.m_pRoot[1];
	tree.m_pRoot[0].m_pRight=&tree.m_pRoot[2];
	tree.m_pRoot[1].m_pLeft=&tree.m_pRoot[3];
	tree.m_pRoot[1].m_pRight=&tree.m_pRoot[4];
	tree.m_pRoot[2].m_pLeft=&tree.m_pRoot[5];
	tree.m_pRoot[2].m_pRight=&tree.m_pRoot[6];
	tree.m_pRoot[3].m_pRight=&tree.m_pRoot[7];
	tree.m_pRoot[6].m_pLeft=&tree.m_pRoot[8];
	tree.m_pRoot[7].m_pLeft=&tree.m_pRoot[9];
	tree.m_pRoot[7].m_pRight=&tree.m_pRoot[10];
	tree.m_pRoot[9].m_pRight=&tree.m_pRoot[11];

	for(long i=0;i<SIZE;i++)
		tree.m_pRoot[i].m_data=i+1;

	tree.CheckNodeNum(tree.m_pRoot);

	cout<<tree.GetTreeNodeNum()<<endl;

	cout<<tree.CheckDepth(tree.m_pRoot)<<endl;
	for(i=0;i<SIZE;i++)
		tree.m_pRoot[i].Clear();

	delete [] tree.m_pRoot;
	return 0;
}

⌨️ 快捷键说明

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