Tree Multiset
Hello guys :)
I've read this blog by adamant. So my question is: Is there a way to get kth number in a multiset. Thanks in advance.
(Sorry for bad English)
you can transform any set into multiset. Just like in adamant's example:
typedef tree<pair<int, int>, ...> ordered_set; ordered_set X; int cnt = 0; X.insert({1, cnt}); cnt += 1; X.insert({1, cnt}); cnt += 1; X.insert({2, cnt}); cnt += 1; cout << X.find_by_order(1)->first << endl; // 1 cout << X.order_of_key({2, 0}) << endl; // 2
Ohhh thanks, you're right. I feel so dumb now :d
you can transform any set into multiset. Just like in adamant's example:
Ohhh thanks, you're right. I feel so dumb now :d