Rename bst_sucessor_and_precessor.py to bs_sucessor_and_precessor.py

This commit is contained in:
bt3gl 2023-08-08 15:39:44 -07:00 committed by GitHub
parent ef073d11ca
commit 27f5ce1c6f
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