mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Update bt_bfs.py
This commit is contained in:
parent
1044a13ad9
commit
f1a8659193
@ -18,19 +18,3 @@ def bfs_iterative(root) -> list:
|
|||||||
queue.append(node.right)
|
queue.append(node.right)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def bfs_recursive(root) -> list:
|
|
||||||
|
|
||||||
result = []
|
|
||||||
|
|
||||||
def helper(node):
|
|
||||||
|
|
||||||
if node:
|
|
||||||
result.append(node.val)
|
|
||||||
helper(node.left)
|
|
||||||
helper(node.right)
|
|
||||||
|
|
||||||
helper(root)
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user