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

📄 binary_tree.h

📁 Binary_tree.cpp :执行文件生成所有二叉树 这样做的目的C + +程序是产生所有二叉树指定节点数目。 基本思想是衍生所有二叉树基于退化树。 该算法的动机是圆括号法则代表二叉
💻 H
字号:
/********************************************************************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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -