q06MergeBinaryTrees
solutions.q06MergeBinaryTrees
Question 6 [PY]
Given two binary trees, \(A,B\), WAP to compute a merge operation defined as follows:
Imagine that one is put on to cover the other; some nodes overlap, while others don’t. The merge rule states that for each position in the binary tree, if two nodes overlap, the value of the merged node is their sum; otherwise, it’s the value of not null node. E.g.
Functions:
Name | Description |
---|---|
q06MergeBinaryTrees |
Args: |