Hi, I am stuck between the concept of Map in STL Library / C ++.
int arr[] = {10,15,14,13,17,15,16,12,18,10,29,24,35,36};
int n = sizeof arr / sizeof *arr;
map<int, bool> bst;
map<int, bool>::iterator it;
vector<int> median_output;
const int k = 5;
for (int i = 0; i < k; ++i) {
bst.insert(make_pair(arr[i], true));
}
for (it = bst.begin(); it != bst.end(); it++) {
cout << (*it).first << " ";
}
Now that I printed this card, it was printed in sorted order. Now there is some simple way to find the middle of this map ..... We need to find the median big problem ... Therefore, we are trying to implement a balanced binary search tree.
source
share