binary_tree.h

来自「Binary_tree.cpp :执行文件生成所有二叉树 这样做的目的C 」· C头文件 代码 · 共 65 行

H
65
字号
/********************************************************************Binary_tree.h : header file for generating all the binary tree The purpose of this C++ Program is to generate all the binary trees given the node number.The basic idea is to evolve all the binary trees from the degenerate tree.The algorithm is motivated by the parenthesis representation of binary trees.The parenthesis set can be organized through lexicographical order. But the algorithmin the code has not simply converted from parenthesis representation; insteadit has kept on shifting the last node from the latest binary tree to the nextpossible left handside position(here we assume the degenerate tree is right handside).This file has also computed the memory reference times(read/write) and avarage reference times.This program works in microsoft visual studio 2005 environment.Author: Date: Oct18,2008*********************************************************************/#include <stdio.h>#include <stdlib.h>#include <malloc.h>#include <iostream>#include <fstream>#include <iomanip>#include <stack>using namespace std;#define MaximumNode 50#define LENGTH sizeof(struct record)ofstream fout("table.txt");//Global Variableint lt[MaximumNode];int rt[MaximumNode];int binary_array[MaximumNode];int Tree_Node_Num;int counter = 1;int root = 1;int REF = 0;int REF_temp = 0;int counter_temp = 0;std::stack<int> s;typedef struct record{	int info;	struct record *next;}queuerecord,*quePointer;//Function declarationvoid build_tree(int);void Convert2Binary(int);void build_first_tree(int);int mostRightTree(int);void findInsertPos(int);int findParent(int);int getRightPos(int);

⌨️ 快捷键说明

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