Check if two binary trees are identical (Algorithm