category-wise-problems

contains category wise problems(data structures, competitive) of popular platforms.

View the Project on GitHub mayankdutta/category-wise-problems

bottom view of the binary tree

Code ```cpp class Solution { public: vector bottomView(Node *root) { map<int, int> mp; queue<pair<Node*, int>> qu; qu.push({root, 0}); while (!qu.empty()) { int Size = qu.size(); for (int i = 0; i < Size; i++) { auto root = qu.front().first; auto hd = qu.front().second; qu.pop(); // if (!mp.count(hd)) { mp[hd] = root -> data; // } if (root -> left) qu.push({root -> left, hd - 1}); if (root -> right) qu.push({root -> right, hd + 1}); } } vector ans; for (const auto& i: mp) ans.push_back(i.second); return ans; } }; ``` </details>