ques : https://practice.geeksforgeeks.org/problems/print-a-binary-tree-in-vertical-order/1
sol : https://ide.codingblocks.com/s/278026
one test case is failing in GFG. it passes all cases in hacker blocks
can you tell me the error?
ques : https://practice.geeksforgeeks.org/problems/print-a-binary-tree-in-vertical-order/1
sol : https://ide.codingblocks.com/s/278026
one test case is failing in GFG. it passes all cases in hacker blocks
can you tell me the error?
Your link is not opening. Just check.
May be cb ide is down now.
it have sent it again
pratyush, please accept my doubts if you are able to answer it. Dont leave like this midway
Sorry for the late response . Just wait for some minutes, i am checking your code now.
@chaman9
With your map based approach , ordering is not being taken care of.
Consider a test case
1
10 2 3 N 5 N N N 6
10
/\
2 3
\
5
\
6
Expected o/p would be:
2 10 5 3 6
But your code will give o/p as
2 10 5 6 3
So if you are following the map based approach, use a level order traversal
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.