full binary tree != 满二叉树

 国内教材对满二叉树的定义:

一棵深度为k且有2^k-1个结点的二叉树称为满二叉树. ————严蔚敏《数据结构(C语言版)》124页

即达到饱和的二叉树。也可以这么定义:

同时满足下面两个条件的二叉树称为满二叉树:

(1)每个结点要么有两个子结点,要么没有子结点;

(2)叶子结点只能出现在最后一层。

下图是一棵符合国内教材定义的满二叉树:

《full binary tree != 满二叉树》

国际上对full binary tree的定义:

A binary tree in which each node has exactly zero or two children.In other words, every node is either a leaf or has two children. For efficiency, any Huffman coding is a full binary tree.

 ———— NIST: http://xlinux.nist.gov/dads/HTML/fullBinaryTree.html

用中文描述一下,也可以这样定义:

满足下面这个条件的二叉树称为满二叉树:

每个结点要么有两个子结点,要么没有子结点。

下图是一棵符合NIST定义的满二叉树:

《full binary tree != 满二叉树》

可见,国际上对full binary tree的定义比国内教材对满二叉树的定义放宽了要求,不要求所有叶子几点必须在最后一层出现。

国内教材定义的满二叉树这类树,NIST也有相应的定义,称为perfect binary tree

A binary tree with all leaf nodes at the same depth. All internal nodes have degree 2. 

————NIST: http://xlinux.nist.gov/dads/HTML/perfectBinaryTree.html

国内教材定义的完全二叉树和国际定义的complete binary tree相符:

A binary tree in which every level, except possibly the deepest, is completely filled. At depth n, the height of the tree, all nodes must be as far left as possible. 

————http://xlinux.nist.gov/dads/HTML/completeBinaryTree.html

下图是一棵完全二叉树:

《full binary tree != 满二叉树》

    原文作者:满二叉树
    原文地址: https://blog.csdn.net/threadrunner/article/details/8739847
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞