File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -392,7 +392,7 @@ public BSTNode<T> predecessor(BSTNode<T> x) {
392
392
// (01) x是"一个右孩子",则"x的前驱结点"为 "它的父结点"。
393
393
// (02) x是"一个左孩子",则查找"x的最低的父结点,并且该父结点要具有右孩子",找到的这个"最低的父结点"就是"x的前驱结点"。
394
394
BSTNode<T > y = x. parent;
395
- while ((y!= null ) && (x== y. left)) {
395
+ while ((y!= null ) && (x== y. left)) {// 满足条件,不断往上追溯,直到找到右祖先结点
396
396
x = y;
397
397
y = y. parent;
398
398
}
@@ -416,7 +416,7 @@ public BSTNode<T> successor(BSTNode<T> x) {
416
416
// (01) x是"一个左孩子",则"x的后继结点"为 "它的父结点"。
417
417
// (02) x是"一个右孩子",则查找"x的最低的父结点,并且该父结点要具有左孩子",找到的这个"最低的父结点"就是"x的后继结点"。
418
418
BSTNode<T > y = x. parent;
419
- while ((y!= null ) && (x== y. right)) {
419
+ while ((y!= null ) && (x== y. right)) {// 满足条件,不断往上追溯,直到找到右祖先结点
420
420
x = y;
421
421
y = y. parent;
422
422
}
You can’t perform that action at this time.
0 commit comments