What exactly is the top view of a binary tree?
I find great ambiguity and lack of clarity from the articles I find.
For example, this is what is used to demonstrate the top view on geeksforgeeks:
1
/ \
2 3
/ \ / \
4 5 6 7
They go on to say that the top view is 4 2 1 3 7. The problem here is that they leave a lot of speculation on what isn't the top view. Consequently it becomes ambiguous to implement in code.
Stackoverflow examples so far are not any better. Hackerrank's example is even worse.
So I am hoping someone will tell me explicitly what the top view is because I have been trying to find out for 2 days. For instance, what is the top view of this tree:
1
\
14
/ \
3 15
/ \
2 7
/ \
4 13
/ \ /
5 6 10
/ \
8 11
\ \
9 12
And if I may be bold to ask, why is it important?