Rename bst_pre_sucessor.py to bst_sucessors_and_precessors.py

This commit is contained in:
bt3gl 2023-08-08 15:32:21 -07:00 committed by GitHub
parent 23c20d4aaa
commit f08037aeb8
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