mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-06 00:35:00 -04:00
Rename find_inorder_successor.py to bst_find_inorder_successor.py
This commit is contained in:
parent
57075bd388
commit
e0d9624032
1 changed files with 0 additions and 0 deletions
18
trees/bst_find_inorder_successor.py
Normal file
18
trees/bst_find_inorder_successor.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# author: bt3gl
|
||||
|
||||
|
||||
def find_inorder_successor(root):
|
||||
|
||||
successor = None
|
||||
|
||||
while root:
|
||||
|
||||
if root.val <= p.val:
|
||||
root = root.right
|
||||
else:
|
||||
successor = root
|
||||
root = root.left
|
||||
|
||||
return successor
|
Loading…
Add table
Add a link
Reference in a new issue