At timestap 1:47

how cin>>root and cout<<root
taking input and
priniting whole tree

i suppose prateek bhaiya has made overloaded function for >> and << operators

i am unable to do question of right view because i am not able to build tree

share ur code that u madde

i dont know how to build the tree


i was just able to take input

can u please share the code of prateek bhaiya @chhavibansal

hey @kartik-malik

node* buildtree(){
	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;
}
1 Like

i dont not have it u might have to watch all previous videos he would have discussed the code there

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.