没有合适孩子的节点X如何拥有后继者? [英] How can a node X without right child have a successor?
本文介绍了没有合适孩子的节点X如何拥有后继者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当节点X
没有合适的子节点时,我很难理解节点的后继者是什么.
I have a trouble understanding what's a successor of a node X
whenever it doesn't have a right child.
据我了解,如果节点X
没有正确的子节点,那么它将没有后继节点.
From what I had understood, if a node X
had no right child, then it would not have a successor.
但是我的教科书上说:
如果节点
X
的右子树为空,并且X
具有后继Y
...
If the right sub-tree of node
X
is empty andX
has a successorY
...
X
没有合适的孩子怎么能拥有继任者?
How can X
have a successor when it has not right child?
推荐答案
后继者只是有序序列中的下一个元素;它不一定必须是子元素.
The successor is simply the next element in the ordered sequence; it doesn't necessarily have to be a child element.
例如,下面的5
的后继者是7
:
For example, the successor of 5
below is 7
:
7
/ \
5 8
这篇关于没有合适孩子的节点X如何拥有后继者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文