merge two binary trees sloved in ruby code example
Example: merge two binary trees sloved in ruby
treeNode mergedBinaryTree(treeNode root1, treeNode root2)
{
if(root1.value == NULL)
return root2
if(root2.value == NULL)
return root1
root1.value += root2.value
root1.left = mergedBinaryTree(root1.left, root2.left)
root1.right = mergedBinaryTree(root1.right, root1.right)
return root1
}