✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
In Part 5, you implement find_node(node, target) to perform Depth-First Search on an action history tree:
history = TreeNode("Start")
type_text = TreeNode("Type text")
open_file = TreeNode("Open file")
add_title = TreeNode("Add title")
delete_line = TreeNode("Delete line")
history.add_child(type_text)
history.add_child(open_file)
type_text.add_child(add_title)
type_text.add_child(delete_line)
Which Python snippet correctly implements DFS to locate a target node?