![]() |
VOOZH | about |
Given a binary tree, print all nodes will are full nodes. Full Nodes are nodes which has both left and right children as non-empty.
Examples:
Input : 10 / \ 8 2 / \ / 3 5 7 Output : 10 8 Input : 1 / \ 2 3 / \ 4 6 Output : 1 3
This is a simple problem. We do any of the traĀverĀsals (Inorder, PreĀorder, PosĀtorder, level order traversal) and keep printing nodes that have mode left and right children as non-NULL.
Implementation:
1 3
Time Complexity : O(n)
Space complexity: O(n) for Recursive Stack Space in case of Skewed Tree