rbt: check if returned node is neel

This commit is contained in:
c9s 2021-06-07 02:25:49 +08:00
parent 3b0ed4e3dc
commit 062443a29c

View File

@ -355,6 +355,10 @@ func (tree *RBTree) RightmostOf(current *RBNode) *RBNode {
current = current.Right
}
if current == tree.neel {
return nil
}
return current
}
@ -371,6 +375,10 @@ func (tree *RBTree) LeftmostOf(current *RBNode) *RBNode {
current = current.Left
}
if current == tree.neel {
return nil
}
return current
}