algorithm - Order Statistic Tree in C++ -


i need order statistic tree standard gcc stl map containers.

i checked , there known pbds. policy based data structures. usage not clear me.

anyone can tell me how use stl map containers order statistic tree? if on gnu g++ enough?

here example of gnu policy-based stl map implemented order statistic tree (tested on linux gcc 4.6.1):

#include <iostream> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>  using namespace std; using namespace __gnu_pbds;  typedef tree<   int,   int,   less<int>,   rb_tree_tag,   tree_order_statistics_node_update> map_t;  int main() {   map_t s;   s.insert(make_pair(12, 1012));   s.insert(make_pair(505, 1505));   s.insert(make_pair(30, 1030));   cout << s.find_by_order(1)->second << '\n';   return 0; } 

here a link overview of gnu policy-based data structures. here other tree_order_statistics example. cannot find reference policy-based data structures, can use these links pbds sources.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -