How to Check if a Binary Tree Is Symmetric in C++

A binary tree is called a symmetric tree if the left subtree of the root node is the mirror image of the right subtree.
In simple words, if we divide the tree from the root, both sides should look like mirror images of each other.

A tree is a data structure similar to Linked list in which each node points to multiple nodes instead of simply pointing to the next node. A tree is called Binary tree if each node in a tree has maximum of two nodes.
An empty tree is also a Binary tree. We can call the two children of each node as Left and Right child of a node. The node of the tree which has no parent is called the Root of the tree. Perhaps Binary tree is the most used tree data structure in the programming world. Before going ahead have a look into Binary Tree basics, Binary Tree Traversal and Binary Tree implementation.

(more…)
How to Check if a Binary Tree Is Symmetric in C++ Read More