| 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){ |
| 34 | m[root->hd].first = d; |
| 35 | m[root->hd].second = root->data; |
| 36 | } |
| 37 | if(root->left) |
| 38 | bottomView(root->left, m, d+1 ); |
| 39 | |
| 40 | if(root->right) |
| 41 | bottomView(root->right, m, d+1); |
| 42 | } |
| 43 | |
| 44 | int main(){ |
| 45 |