please help me with the input format. i am not able to understand the input taken.
please help
Tree bottom view
Hello @ankit152,
hello,
You have to buildtree with the help of queue. Prateek bhaiya has taught tree building level wise. I would suggest you to watch github repo where prateek bhaiya build a function buildtreelevelwise.
Hope, this would help.
you can refer https://ide.codingblocks.com/s/65868?_ga=2.27498620.1579452958.1561478804-1448590793.1559468415 3.
Hope, this would help.
Give a like if you are satisfied.
2 has child nodes 4 and 5 whereas 3 has child node 6.
2 has child nodes 4 and 5 whereas 3 has child node 6. so the bottom view should look like 4 2 5 6 3. help me in understanding the output.
Hello @ankit152,
To understand this output you have to imagine the physical structure of the tree.
For the given input set, the tree formed would look like following diagram:
________1
____2_______3
__4_____5
________6
What is happening here is 1,5 and 6 are co-linear i.e. they all lie on the same line.
As 6 comes after 5, thus 6 overlaps the view of 5 from bottom.
Hence, output is 4 2 6 3.
Hope, this would help.