Test case 1 is incorrect

test case 1 is incorrect please see my code

hi @varu
the problem is your approach you have not consider the following cases
try to consider these also
A node is included in bottom view if it can be seen when we look at the tree from bottom.

                  20
                /    \
              8       22
            /   \        \
          5      3       25
                /   \      
              10    14

For the above tree, the bottom view is 5 10 3 14 25.
If there are multiple bottom-most nodes for a horizontal distance from root, then print the later one in level traversal. For example, in the below diagram, 3 and 4 are both the bottommost nodes at horizontal distance 0, we need to print 4.

                  20
                /    \
              8       22
            /   \     /   \
          5      3 4     25
                 /    \      
             10       14

For the above tree the output should be 5 10 4 14 25.

i hope this help
first try to modify your code at your own
if you have more doubts regarding this feel free to as

Reference Code only if needed

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course