need some hints to solve the question unable to think of the approach
Tree bottom view
@Divya_321
u can use hash map to solve this problem.
where key of hashmap can be horizontal distance of node,
value can be a pair(x,y) where x is node value and y is node height.
haven’t studied hash map yet, may you suggest any other as I have constructed level oerder tree by queue but how I will make sure that out of 1,5,6 on the same level 6 the rightmost will get printed
@Divya_321
another approach also uses map.
so please checkout stl map video in ur course (hardly take 10 min to understand)
adding some links-
.https://www.geeksforgeeks.org/map-associative-containers-the-c-standard-template-library-stl/.
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.
@aman212yadav this is my code:https://ide.codingblocks.com/s/186135
I am able to pass all test cases except please correct it, and specify my mistake
@Divya_321
Hello divya,
your code is incorrect. you are using level (height ) as ur map key but actually you key should be horizontal distance of your current node from root node.