Skip to content

Commit 323963f

Browse files
authored
Update balance-a-binary-search-tree.py
1 parent c6dc8f1 commit 323963f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Python/balance-a-binary-search-tree.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def __init__(self, x):
99
self.right = None
1010

1111

12+
# dfs solution with stack
1213
class Solution(object):
1314
def balanceBST(self, root):
1415
"""
@@ -54,6 +55,7 @@ def sortedArrayToBst(arr):
5455

5556
# Time: O(n)
5657
# Space: O(h)
58+
# dfs solution with recursion
5759
class Solution2(object):
5860
def balanceBST(self, root):
5961
"""

0 commit comments

Comments
 (0)