Question: Given a binary tree root node, get the maximum width of that tree Example: Consider the image given below Width at level 1 is 1. Because it has only 1 node. Width at level 2 is 2. Because it has only 2 nodes. Width at …

Question: Given a binary tree root node, get the level of the node. Example: Consider the image given below If the given node is “25” level is 2 If the given node is “15” level is 3 Steps to get the level of a given node: …

Question: Given a binary tree root node, delete that tree Example: Consider the tree given below. How do you delete it? Here if you delete root node first, the you will loose link to left and right children. So we need to user post order traversal. …

Question: Given a binary tree root node, convert that tree to it’s mirror. Example: Consider the image given below and its mirror. Above image shows a tree and it’s mirror tree. From the above image we can see that, except the root node, all the other …

Question: Given a binary tree root node, perform Post Order traversal by using stacks. Example: Consider the image given below: PostOrder Traversal (Left, Right, Root): 7 15 10 18 30 25 16 Now lets see how to perform Post Order Traversal: (Left, Right, Root) In Post-Order …

Question: Given a binary tree root node, perform In Order traversal by using stacks. Example: Consider the image given below: InOrder Traversal (Left, Root, Right): 7 10 15 16 18 25 30 Now lets see how to perform In Order Traversal: (Left, Root, Right) In In-Order …

Question: Given a binary tree root node, perform PreOrder traversal by using stacks. Example: Consider the image given below: PreOrder Traversal(Root, Left, Right): 16 10 7 15 25 18 30 Now lets see how to perform Pre Order Traversal: (Root, Left, Right) In pre Order traversal, …

Question: Given a binary tree root node, display all the nodes in reverse level order traversal. Example: Consider the image given below: Form the image above, reverse level order traversal is: 7, 15, 18, 30, 10, 25, 16 Solution: Solution is similar to level order traversal, …

Question: Given a binary tree root node and a level, display all the nodes present in that level. Example: Consider the image given below: Form the image above, Nodes at level 1 are : 16 Nodes at level 2 are : 10, 25 Nodes at level …