View algorithms on Trees
Question: Given the root pointer to a binary tree, find the number of full nodes. Input: Sample Tree (Pointer to node 1 is given). Find the number of full nodes. Output: Number of full nodes = 3 According to the definition, the set of all nodes with both left and right child are called as full nodes. In the above example, we have the nodes – 1. 2, 3 as full nodes. We can perform a level order traversal and count the number of nodes, who have their right child…