Tree bottom view problem

Can I know the logic/explanation of the sample input and sample output of this problem. I am not asking about the code.

I think the tree is:
1
/
2 3
/ \ /
4 5 6

How can the bottom view consist of 4,2,6 and 3?

@nayakashutosh99 hey ashutosh nayak
the reason why 5 is not in output is because 1 5 6 are on same level as viewed from bottom , and so 6 is the last node to enter in that level , hence 6 is viewed .
The tree is basically like -
_______1
___2 _______3
_4 ____5 ___
______6 _______

how did you know that 6 is not in the same level as 4 and 5 and it’s in the next level?

@nayakashutosh99 hey ashutosh this level order you need to have a queue to process this tree

this is level order function dry run on it
______ 1
____2 _______3
_4 ____5 ___
______ 6 _______
node* buildTreeLevelWise(){

int d;
cin>>d;

node*root = new node(d);
queue<node*> q;
q.push(root);

while(!q.empty()){

	node*f = q.front();
	q.pop();
	int c1,c2;
	cin>>c1>>c2;

	if(c1!=-1){
		f->left = new node(c1);
		q.push(f->left);
	}
	if(c2!=-1){
		f->right = new node(c2);
		q.push(f->right);
	}
}
return root;

}
level means 1 5 6 making a striaght line that why 6
hide 1 and 5 and will lead to fail print 1 and 5