Q:

how to differentiate all levels in level order traversal of tree

Example 1:

Output for above tree should be
20
8 22
4 12
10 14

Example 2:
          1
       /     \
      2       3
    /   \       \
   4     5       6
        /  \     /
       7    8   9
Output for above tree should be
1
2 3
4 5 6
7 8 9<

0

New to Communities?

Join the community