Tree bttom view


why code is not working for two test cases

you are supposed to print the bottom view of the tree, not the preorder traversal of tree.
for eg.
if the tree is: 1 2 3 4 5 -1 -1.
the preorder is: 1 2 4 5 3
bottom view: 4 2 5 3 (what you see when you look from bottom)

you are expected to print the later one.

thanks