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

📄 prg10_1.cpp

📁 这是数据结构和算法的国外经典书籍.清华大学出版社出版的<数据结构C++语言描述-应用模板库STL>陈君 译 英文名称是Data Structures with C++ Using STL.
💻 CPP
字号:
// File: prg10_1.cpp
// the program demonstrates the inorder and postorder
// recursive binary tree scanning algorithms and the
// iterative level-order scanning algorithm. using the
// function buildTree(), construct Tree 1 and call the
// tree output algorithms from the library "d_tlib.h".

#include <iostream>

#include "d_tnode.h"		// tnode class
#include "d_tnodel.h"	// tnode library

using namespace std;

int main()
{
	// root of the tree
	tnode<char> *root;

	// use the character Tree 1 
	root = buildTree(1);

	// give inorder scan of nodes  
	cout << "Inorder scan:      " ;
	inorderOutput(root);
	cout << endl;

	// give postorder scan of nodes   
	cout << "Postorder scan:    " ;
	postorderOutput(root);
	cout << endl;

	// give level order scan of nodes   
	cout << "Level-order scan:  " ;
	levelorderOutput(root);
	cout << endl;

	return 0;
}

/*
Run:

Inorder scan:      D  B  G  E  A  C  H  F  I
Postorder scan:    D  G  E  B  H  I  F  C  A
Level-order scan:  A  B  C  D  E  F  G  H  I
*/

⌨️ 快捷键说明

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