Skip to content

Commit 4bac67b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 46642ef commit 4bac67b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

height_of_tree/tree.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def __str__(self) -> str:
1111
"""
1212
return str(self.info)
1313

14+
1415
class BinarySearchTree:
1516
def __init__(self) -> None:
1617
self.root: Node | None = None
@@ -45,6 +46,7 @@ def create(self, val: int) -> None:
4546
else:
4647
break
4748

49+
4850
def height(node: Node | None) -> int:
4951
"""
5052
>>> height(None)
@@ -62,6 +64,7 @@ def height(node: Node | None) -> int:
6264
return -1
6365
return 1 + max(height(node.left), height(node.right))
6466

67+
6568
def tree_height_from_list(data: list[int]) -> int:
6669
"""
6770
>>> tree_height_from_list([3,2,5,6])
@@ -76,6 +79,8 @@ def tree_height_from_list(data: list[int]) -> int:
7679
bst.create(x)
7780
return height(bst.root)
7881

82+
7983
if __name__ == "__main__":
8084
import doctest
85+
8186
doctest.testmod()

0 commit comments

Comments
 (0)