Graph Theory37 sections · 1633 units
Open in CourseQuiz: Tree Comparison
Knowledge check
Check Your Understanding
You check if binary trees are identical using recursive DFS. Your base case returns true when both nodes are null. What should you return when exactly one node is null and the other is not?
- A.
true, because the non-null subtree might still match later - B.Recurse deeper into the non-null node
- C.
false, because one tree has a node where the other does not - D.Compare the non-null node's value with