文件名称:Two-forks-tree-problem
介绍说明--下载内容均来自于网络,请自行研究使用
二叉树问题
1、 按根、左子树和右子树三部分进行遍历
遍历二叉树的顺序存在下面6种可能:
TLR(根左右), TRL(根右左)
LTR(左根右), RTL(右根左)
LRT(左右根), RLT(右左根)
其中,TRL、RTL和RLT三种顺序在左右子树之间均是先右子树后左子树,这与人们先左后右
的习惯不同,因此,往往不予采用。余下的三种顺序TLR、LTR和LRT根据根访问的位置不同分别
被称为先序遍历、中序遍历和后序遍历。
(1)先序遍历
若二叉树为空,则结束遍历操作;否则
访问根结点;
先序遍历左子树;
先序遍历右子树。
(2)中序遍历若二叉树为空,则结束遍历操作;否则
中序遍历左子树;
访问根结点;
中序遍历右子树。
(3)后序遍历
若二叉树为空,则结束遍历操作;否则
后序遍历左子树;
后序遍历右子树;
访问根结点。-1, according to the root, the left subtree and the right subtree traversal three partTraverse the two fork tree sequence there are 6 possible:TLR ( or so ), TRL ( root of right and left )LTR ( left radical right ), RTL ( right to left )LRT ( or root ), RLT ( right left root )Among them, TRL, RTL and RLT three kinds of sequence in the left and right subtree are to the right subtree after left subtree, and the first leftDifferent habits, therefore, are often not used. The remaining three order of TLR, LTR and LRT respectively according to root access locationKnown as the first traversal, preorder and postorder traversal.( 1) the first traversalIf the two fork tree is empty, then the end of traversal operation otherwiseAccess to the root node Preorder left subtree Preorder right subtree.( 2) in the traversal binary tree is empty if two, then the end of traversal operation otherwiseTraversal of the left subtree Access to the root node Traversal of the right subtree.( 3) after the travers
1、 按根、左子树和右子树三部分进行遍历
遍历二叉树的顺序存在下面6种可能:
TLR(根左右), TRL(根右左)
LTR(左根右), RTL(右根左)
LRT(左右根), RLT(右左根)
其中,TRL、RTL和RLT三种顺序在左右子树之间均是先右子树后左子树,这与人们先左后右
的习惯不同,因此,往往不予采用。余下的三种顺序TLR、LTR和LRT根据根访问的位置不同分别
被称为先序遍历、中序遍历和后序遍历。
(1)先序遍历
若二叉树为空,则结束遍历操作;否则
访问根结点;
先序遍历左子树;
先序遍历右子树。
(2)中序遍历若二叉树为空,则结束遍历操作;否则
中序遍历左子树;
访问根结点;
中序遍历右子树。
(3)后序遍历
若二叉树为空,则结束遍历操作;否则
后序遍历左子树;
后序遍历右子树;
访问根结点。-1, according to the root, the left subtree and the right subtree traversal three partTraverse the two fork tree sequence there are 6 possible:TLR ( or so ), TRL ( root of right and left )LTR ( left radical right ), RTL ( right to left )LRT ( or root ), RLT ( right left root )Among them, TRL, RTL and RLT three kinds of sequence in the left and right subtree are to the right subtree after left subtree, and the first leftDifferent habits, therefore, are often not used. The remaining three order of TLR, LTR and LRT respectively according to root access locationKnown as the first traversal, preorder and postorder traversal.( 1) the first traversalIf the two fork tree is empty, then the end of traversal operation otherwiseAccess to the root node Preorder left subtree Preorder right subtree.( 2) in the traversal binary tree is empty if two, then the end of traversal operation otherwiseTraversal of the left subtree Access to the root node Traversal of the right subtree.( 3) after the travers
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Two forks tree problem\二叉树问题(自创).txt
......................\问题描述.txt
Two forks tree problem