Replace Node With Depth
Given a a binary tree. Replace each of it's data with the depth of tree.
Root is at depth 0, change its value to 0 and next level nodes are at depth 1 and so on.
Print the tree after modifying in inorder fashion.
Example:
Input
Output
Comments
Post a Comment
Please give us your valuable feedback