Check if the left subtree is a mirror image of the right subtree.
Solution 1:
Do an inorder traversal. If result is a pallindrom then symmetric else not symmetric
Solution 2:
A solution that may work is - Preorder is reverse to its postorder
Solution 1:
Do an inorder traversal. If result is a pallindrom then symmetric else not symmetric
Solution 2:
A solution that may work is - Preorder is reverse to its postorder
No comments:
Post a Comment