基本概念
• Binary Tree
▶ CLRS
We define binary trees recursively. A binary tree T is a structure defined on a finite set of nodes that either contains no nodes or is composed of three disjoint sets of nodes: a root node, a binary tree called its left subtree, and a binary tree called its right subtree.
我们可以递归地来定义二叉树。二叉树是一个定义在有限结点集上的数据结构,它要么不包含任何结点,要么包含三个不相交的结点集合 - 一个根结点,一棵称为左子树的二叉树,以及一棵称为右子树的二叉树。
▶ Wikipedia
In computer science, a binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child. A recursive definition using just set theory notions is that a (non-empty) binary tree is a triple (L, S, R), where L and R are binary trees or the empty set and S is a singleton set. Some authors allow the binary tree to be the empty set as well.
在计算机科学中,二叉树是一种树形的数据结构,它的每个结点最多拥有两个孩子,这两个孩子一般被称为左子树和右子树。一种使用集合理论观点的递归定义是:一棵(非空)二叉树是一个三元集合(L,S,R),其中L和R要么是二叉树结点集合,要么是空结点集和;S为单元素结点集和。一些著作中允许一棵二叉树为一个空结点集。
• Full Binary Tree
▶ CLRS
The tree that results is a full binary tree: each node is either a leaf or has degree exactly 2.
这样得到的树是"full binary tree":每个结点要么是叶节点,要么度为2。
▶ Wikipedia
A full binary tree (sometimes proper binary tree or 2-tree or strictly binary tree) is a tree in which every node other than the leaves has two children.
一棵"full binary tree"是每个非叶结点均拥有2个孩子的二叉树。
▶ 注意点
这里定义的"full binary tree"并不能翻译成满二叉树,它的定义与国内约定俗成的满二叉树是不一致的。国内所谓的满二叉树其实与"perfect binary tree"的定义是一致的。
• Perfect Binary Tree
▶ CLRS
A complete k-ary tree is a k-ary tree in which all leaves have the same depth and all internal nodes have degree k.
满k叉树(这里的complete应该翻译为“完整的”)是一棵所有叶节点深度相同且所有内部结点度为k的k叉树。
▶ Wikipedia
A perfect binary tree is a full binary tree in which all leaves are at the same depth or same level, and in which every parent has two children.
满二叉树是一棵"full binary tree",它的所有叶子结点深度相同,并且每个父亲结点度均为2。