we start printing when k==1 then it should print for that level only , why does it keep priniting all levels while coming back up the tree like we have to print 4th level
so k=4 when k reaches 1 it prints it but how other levels are getting printed ,i am having a doubt in that
Printing tree doubt
hey @yatin, when we are on left child, we can’t go to right child directly, hence we have to come to root and go to right child.
When we want to print 4th level and decrementing k value, than only 4th levels gets printed.
To print other level another loop need to be run.
1 Like
ok sir got it
thank you
hey @yatin , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved