This post is completed by 2 users
|
Add to List |
67. Printing Nodes without Siblings in a Binary Tree
Objective: Given a binary tree, Print All the Nodes that don't have siblings.
Note: The sibling node is the node that has the same parent, so you need to print the node that is a single child of his parent.
Example:
Approach:
- Do the inorder traversal.
- check if the node has only a child, if yes then print that child.
Output:
Nodes with No Siblings: 6 7 8 9