这是一个有效的二叉树吗?
Is this a valid binary tree?
我刚刚了解到有 3 种类型的二叉树:完全、完全和退化。
但是,对于下面的这棵树,它并不完全符合我上面列出的 3 种类型的特征。
能有这样的二叉树吗?
18
\
30
/ \
50 40
/ \ / \
60 70 55 77
这棵树不完整、完整或退化。它只是一棵不属于这些类别的二叉树。
是的,可以有这样的二叉树,尽管任何类型的平衡树(AVL、红黑等)看起来都不像这样
Is this a valid binary tree?
是的。
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.",你的树满足。
PS: 这棵树不完整,不完整,不退化。
我刚刚了解到有 3 种类型的二叉树:完全、完全和退化。
但是,对于下面的这棵树,它并不完全符合我上面列出的 3 种类型的特征。
能有这样的二叉树吗?
18
\
30
/ \
50 40
/ \ / \
60 70 55 77
这棵树不完整、完整或退化。它只是一棵不属于这些类别的二叉树。 是的,可以有这样的二叉树,尽管任何类型的平衡树(AVL、红黑等)看起来都不像这样
Is this a valid binary tree?
是的。
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.",你的树满足。
PS: 这棵树不完整,不完整,不退化。