mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Update and rename bst_all_subnodes.py to bst_all_subnodes.py
This commit is contained in:
parent
cd5ac00126
commit
eedb6b6863
@ -14,7 +14,6 @@ def all_possible_bst(start, end, memo):
|
|||||||
|
|
||||||
result = []
|
result = []
|
||||||
if start > end:
|
if start > end:
|
||||||
result.append(None)
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
if (start, end) in memo:
|
if (start, end) in memo:
|
||||||
@ -26,8 +25,7 @@ def all_possible_bst(start, end, memo):
|
|||||||
|
|
||||||
for l in left:
|
for l in left:
|
||||||
for r in right:
|
for r in right:
|
||||||
root = Node(i, l, r)
|
result.append(Node(i, l, r))
|
||||||
result.append(root)
|
|
||||||
|
|
||||||
memo[(start, end)] = result
|
memo[(start, end)] = result
|
||||||
return result
|
return result
|
Loading…
x
Reference in New Issue
Block a user