In Part 4, you write the recursive inner function visit(i) for array_preorder(values):
def array_preorder(values):
result = []
def visit(i):
# TODO
pass
if values:
visit(0)
return result
Which recursive call pattern correctly fills result in preorder for an array representation?
In Part 3, you construct a binary tree using BinaryNode:
binary_root = BinaryNode(
8,
BinaryNode(3, BinaryNode(1), BinaryNode(6)),
BinaryNode(10, None, BinaryNode(14))
)
What list does inorder(binary_root) produce?
A határhaszon…