Mirror image of a binary tree
I think you have over complicated things and I don't think it works for the generic tree (as your create_mirror_for_[left|right]_subtree() only recurse down one side of the tree.

Why the test before a swap?

tree_node* temp = 0;
if(root-&gt;left)
    temp = root-&gt;left;    // If left is NULL you can still assign it 
                          // to temp and get the same result.
root-&gt;left = root-&gt;right;
if(temp)
    root-&gt;right = temp;
else
    root-&gt;right = NULL;   // If temp is null you could just assign
                          // it to right then both sides of the branch
                          // are identical and they collapse into a
                          // single statement.

// Much easier to write as:
tree_node* temp = root-&gt;left;
root-&gt;left      = root-&gt;right;
root-&gt;right     = temp;

// Which of course can be replaced by std::swap
std::swap(root-&gt;left, root-&gt;right);


I assume you want to swap all nodes in the tree (otherwise it's not a mirror).

class Tree
{
    public:
        void mirrorTree()
        {
            root.mirrorTree(root);
        }
    private:
        void mirrorTree(Node* node)
        {
            if (node == nullptr) {
                return;
            }
            using std::swap;
            swap(node-&gt;left, node-&gt;right);
            mirrorTree(node-&gt;left);
            mirrorTree(node-&gt;right);
        }
};