| 21 | } |
| 22 | |
| 23 | void setHorizontalDistance(Tree* root, int hd){ |
| 24 | |
| 25 | if(root == NULL)return; |
| 26 | |
| 27 | root->hd = hd; |
| 28 | setHorizontalDistance(root->left, hd-1); |
| 29 | setHorizontalDistance(root->right, hd +1); |
| 30 | } |
| 31 | void bottomView(Tree *root, map<int, pair<int,int>>&m, int d){ |
| 32 | if(root == NULL)return; |
| 33 | if(m[root->hd].first < d){ |