Binary Tree | Inorder, Preorder, Postorder Recursive and Non-Recursive Traversal | Mirror Binary Tree | Height of Tree | Cloning Binary Tree | Number of Leaves | Number of Internal Nodes | Erasing all nodes of Binary Tree
Problem Statement: Beginning with an empty binary tree, construct a binary tree by inserting the values in the order given. After constructing a binary tree perform the following operations on it- Perform inorder, preorder and postorder traversal (Implement both recursive and non-recursive methods) Change a tree so that the roles of the left and right pointers are swapped at every node Find the height of the tree Copy this tree to another Count number of leaves, number of internal nodes. Erase all nodes in a binary tree Note :- Scroll horizontally to see the full line of code. #include < iostream > using namespace std ; class node { // data members public : int data ; node * left ; node * right ; // node constructor node ( int val ) { data = val ; } }; class nodePointer { public : node * link ; ...