Graph Theory37 sections · 1633 units
Open in Course

Quiz: Tree Comparison

Knowledge check

Check Your Understanding

You check if 22 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?

  1. A.true, because the non-null subtree might still match later
  2. B.Recurse deeper into the non-null node
  3. C.false, because one tree has a node where the other does not
  4. D.Compare the non-null node's value with 00
Start the roadmap to answer the quizzes and solve the challenges