文件名称:Two-forks-tree-problem
-
所属分类:
- 标签属性:
- 上传时间:2012-12-11
-
文件大小:1.3kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
二叉树问题
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
Two forks tree problem/问题描述.txt
Two forks tree problem
Two forks tree problem/问题描述.txt
Two forks tree problem
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.