From a78436b51bad9d11b7f2f65b0e738dfd2ede8fdb Mon Sep 17 00:00:00 2001 From: bt3gl <138340846+bt3gl-cryptographer@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:44:00 -0700 Subject: [PATCH] Update bt_height.py --- trees/bt_height.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trees/bt_height.py b/trees/bt_height.py index 65fa688..bb16d53 100644 --- a/trees/bt_height.py +++ b/trees/bt_height.py @@ -3,7 +3,9 @@ # author: bt3gl def height(root): + if not root: - return -1 + return 0 + return 1 + max(height(root.left), height(root.right))