Nodes without sibling
Given a binary tree, print all nodes that don’t have a sibling.
Given a binary tree, print all nodes that don’t have a sibling.
Elements in level order form (separated by space). If any node does not have left or right child, take -1 in its place.
Print nodes separated by new line.
5 6 10 2 3 -1 -1 -1 -1 -1 9 -1 -1
9
Comments
Post a Comment
Please give us your valuable feedback