mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-06-15 18:39:13 -04:00
Update bs_sucessor_and_precessor.py
This commit is contained in:
parent
0264d26b7e
commit
5108f546c6
1 changed files with 2 additions and 2 deletions
|
@ -6,7 +6,7 @@
|
||||||
def successor(root):
|
def successor(root):
|
||||||
|
|
||||||
root = root.right
|
root = root.right
|
||||||
while root.left:
|
while root:
|
||||||
root = root.left
|
root = root.left
|
||||||
|
|
||||||
return root
|
return root
|
||||||
|
@ -15,7 +15,7 @@ def successor(root):
|
||||||
def predecessor(root):
|
def predecessor(root):
|
||||||
|
|
||||||
root = root.left
|
root = root.left
|
||||||
while root.right:
|
while root:
|
||||||
root = root.right
|
root = root.right
|
||||||
|
|
||||||
return root
|
return root
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue