GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

Please explain this question

https://learn.hackerearth.com/forum/629/print-the-binary-tree-using-breadth-first-traversal-but-reverse-the-elements-of-every-nth-breadth

I'm not able to understand this question. What should the output tree look like ? Can anyone please explain me this question ?

asked May 8, 2016 by koustavc

1 Answer

answered May 9, 2016 by Rakesh Sharad Navale

Is it a simple mirror image ?

No, This question asks you to reverse node arrangement only at specific levels.
So If you understand mirroring, you may say that mirroring of tree at specific level keeping rest same as original tree

"reverse the elements of every nth breadth" --- so if n = 2 , reversal(mirror) needs to be done at 2 , 4 , 6  8 .. level 

                                                                        if n = 3 , reversal(mirror) needs to be done at 3 , 6 , 9  12 .. level  

 

Is my understanding correct now ?

Yes, you got it right

Thank you so much Sir.

...