Rename bst_sucessors_and_precessors.py to bst_sucessor_and_precessor.py

This commit is contained in:
bt3gl 2023-08-08 15:32:38 -07:00 committed by GitHub
parent f08037aeb8
commit 8bc3090801
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,23 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: bt3gl
def successor(root):
root = root.right
while root.left:
root = root.left
return root
def predecessor(root):
root = root.left
while root.right:
root = root.right
return root