#C2782. Mirror Binary Trees
Mirror Binary Trees
Mirror Binary Trees
Given two binary trees, determine whether they are mirror images of each other. Two trees are mirror images if the left subtree of one tree is a mirror reflection of the right subtree of the other tree, and vice versa. Mathematically, if we denote the mirror-check function as (areMirror(\cdot,\cdot)), then for two nodes with values (v_1) and (v_2), the trees rooted at these nodes are mirrors if and only if (v_1 = v_2) and (areMirror(left_1, right_2)) and (areMirror(right_1, left_2)) are both true.
inputFormat
The input consists of two lines provided through standard input. The first line represents the level-order traversal of the first binary tree and the second line represents that of the second binary tree. Nodes are separated by a space and a missing node is represented by the string "null".
outputFormat
Output a single line: "True" if the two binary trees are mirror images of each other, and "False" otherwise.## sample
1 2 3
1 3 2
True