101 Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following is not:
1
/ \
2 2
\ \
3 3
Note:
Bonus points if you could solve it both recursively and iteratively.
@tag-tree

Algorithm

It is necessary to compare whether the value of the left child node of n1 and the value of the right child node of n2 are equal, and also whether the value of the right child node of n1 and the value of the left child node of n2 are equal.