Doubt in vertical order printing of binary tree


i understood logic but i am not able to print
hashtable please debug my code and tell me what mistake i am doing here

@bishtmanish786 In the main you are not even calling the vertical order function to update the hashmap.
Main function would be something like this:
int main() {
int n;cin>>n;
map<int,vector>m; //Hashmap storing distances and root data
node* root=buildbst();
verticalorderprint(root,m,0);
for(auto it=m.begin();it!=m.end();it++)
{
for(int j=0; j < it -> second.size();j++)
{
cout<second[j]<<" ";
}
cout<<endl;
}
return 0;
}

If you have any more problem in implementation, you can refer the webinar on hashing where Prateek Bhaiya has discussed this question and its implementation.

Hope this helps :slightly_smiling_face:

@pratyush63 sir your code in not working https://ide.codingblocks.com/s/119469 please update my code how to print hashtable

Refer this code.
At a particular distance from a root node, multiple nodes may be present so instead of map<int,int> use map<int,vector < int > >