本文主要是介绍完全二叉树和完满二叉树,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
完全二叉树(Complete Binary Tree)
A Complete Binary Tree (CBT) is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.
换句话说,完全二叉树从根结点到倒数第二层满足完美二叉树,最后一层可以不完全填充,其叶子结点都靠左对齐。
例如:
完满二叉树(Full Binary Tree)
A Full Binary Tree (FBT) is a tree in which every node other than the leaves has two children.
换句话说,所有非叶子结点的度都是2。(只要你有孩子,你就必然是有两个孩子。)
注:Full Binary Tree又叫做Strictly Binary Tree。
例如:
这篇关于完全二叉树和完满二叉树的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!