Check if two trees are identical?
bool IsIdentical(TreeNode p, TreeNode q) {
if (p == null && q == null) return true;
if (p == null || q == null) return false;
if (p.val != q.val) return false;
return IsIdentical(p.left, q.left) && IsIdentical(p.right,
q.right);
Explanation:
Recursive check values and structure for equality.