Create bt_height.py

This commit is contained in:
marina 2023-08-03 15:50:27 -07:00 committed by GitHub
parent 75eb7e2dd9
commit 46b4f11520
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

9
trees/bt_height.py Normal file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: bt3gl
def height(root):
if not root:
return -1
return 1 + max(height(root.left), height(root.right))