I am unable to see output please have a look at my code
#include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node *left;
Node *right;
Node (int d){
data=d;
left=NULL;
right=NULL;
}
};
// Node *insertBST(Node *root,int d){
// //cout<<“d is”<<d<<endl;
// if(root==NULL){
// root= new Node(d);
// return root;
// }
// //cout<<“yo yo”;
// if(ddata)
// root->left=insertBST(root->left,d);
// else
// root->right=insertBST(root->right,d);
// return root;
// }
Node* createTreeFromLevelOrder()
{
int d;
cin>>d;
Node* root=new Node(d);
queue<Node > q;
q.push(root);
while(!q.empty())
{
int d1,d2;
cin>>d1>>d2;
Node f=q.front();
if(d1!=-1)
{
f->left=new Node(d1);
q.push(f->left);
}
if(d2!=-1)
{
f->right=new Node(d2);
q.push(f->right);
}
q.pop();
}
return root;
}
void Bottom(Node *root, int dist ,int level,auto &map){
if(root==NULL){
return;
}
if(level>=map[dist].second){
map[dist]={root->data,level};
}
Bottom(root->left,dist-1,level+1,map);
Bottom(root->right,dist+1,level+1,map);
}
void Bottom(Node *root){
map <int,pair<int,int>> mp;
Bottom(root,0,0,mp);
for(auto yu: mp){
cout<<yu.second.first<<" ";
}
}
int main() {
Node *root=createTreeFromLevelOrder();
Bottom(root);
return 0;
}