📜  合并在 ruby 代码示例中处理的两个二叉树

📅  最后修改于: 2022-03-11 15:04:46.734000             🧑  作者: Mango

代码示例1
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
}