<i id='Hz9zm'><tr id='Hz9zm'><dt id='Hz9zm'><q id='Hz9zm'><span id='Hz9zm'><b id='Hz9zm'><form id='Hz9zm'><ins id='Hz9zm'></ins><ul id='Hz9zm'></ul><sub id='Hz9zm'></sub></form><legend id='Hz9zm'></legend><bdo id='Hz9zm'><pre id='Hz9zm'><center id='Hz9zm'></center></pre></bdo></b><th id='Hz9zm'></th></span></q></dt></tr></i><div id='Hz9zm'><tfoot id='Hz9zm'></tfoot><dl id='Hz9zm'><fieldset id='Hz9zm'></fieldset></dl></div>
  • <small id='Hz9zm'></small><noframes id='Hz9zm'>

  • <tfoot id='Hz9zm'></tfoot>

        <bdo id='Hz9zm'></bdo><ul id='Hz9zm'></ul>
      <legend id='Hz9zm'><style id='Hz9zm'><dir id='Hz9zm'><q id='Hz9zm'></q></dir></style></legend>

      1. C++中的订单统计树

        时间:2023-10-07
          • <bdo id='iOcl9'></bdo><ul id='iOcl9'></ul>
            <legend id='iOcl9'><style id='iOcl9'><dir id='iOcl9'><q id='iOcl9'></q></dir></style></legend>

            <i id='iOcl9'><tr id='iOcl9'><dt id='iOcl9'><q id='iOcl9'><span id='iOcl9'><b id='iOcl9'><form id='iOcl9'><ins id='iOcl9'></ins><ul id='iOcl9'></ul><sub id='iOcl9'></sub></form><legend id='iOcl9'></legend><bdo id='iOcl9'><pre id='iOcl9'><center id='iOcl9'></center></pre></bdo></b><th id='iOcl9'></th></span></q></dt></tr></i><div id='iOcl9'><tfoot id='iOcl9'></tfoot><dl id='iOcl9'><fieldset id='iOcl9'></fieldset></dl></div>
          • <small id='iOcl9'></small><noframes id='iOcl9'>

              <tbody id='iOcl9'></tbody>
            <tfoot id='iOcl9'></tfoot>

                • 本文介绍了C++中的订单统计树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我需要标准 GCC STL 地图容器的订单统计树.

                  I need an order statistic tree for standard GCC STL map containers.

                  我查了一下,有一种叫做 PBDS 的东西.基于策略的数据结构.我也不清楚这种用法.

                  I checked and there is something known as PBDS. Policy based data structures. That usage is also not clear to me.

                  谁能告诉我如何将 STL 映射容器用于订单统计树?即使它只在 GNU G++ 上就足够了吗?

                  Anyone can tell me how to use STL map containers for order statistic tree? Even if its only on GNU G++ its enough?

                  推荐答案

                  以下是将 GNU Policy-Based STL MAP 实现为订单统计树的示例(在 Linux gcc 4.6.1 上测试):

                  Here is the example of GNU Policy-Based STL MAP implemented as 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 << '
                  ';
                    return 0;
                  }
                  

                  这里是基于 GNU 策略的数据结构概述的链接.这是其他 tree_order_statistics 示例.我找不到有关基于策略的数据结构的好的参考资料,但您可以使用这些链接以及 PBDS 来源.

                  Here is a link to the overview of GNU Policy-Based Data Structures. Here is other tree_order_statistics example. I cannot find a good reference for Policy-Based Data Structures, but you can use these links as well as PBDS sources.

                  这篇关于C++中的订单统计树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:C++ 是否存在循环列表的标准实现? 下一篇:在链表中添加列表项或节点

                  相关文章

                  最新文章

                    <bdo id='uORoP'></bdo><ul id='uORoP'></ul>

                    <i id='uORoP'><tr id='uORoP'><dt id='uORoP'><q id='uORoP'><span id='uORoP'><b id='uORoP'><form id='uORoP'><ins id='uORoP'></ins><ul id='uORoP'></ul><sub id='uORoP'></sub></form><legend id='uORoP'></legend><bdo id='uORoP'><pre id='uORoP'><center id='uORoP'></center></pre></bdo></b><th id='uORoP'></th></span></q></dt></tr></i><div id='uORoP'><tfoot id='uORoP'></tfoot><dl id='uORoP'><fieldset id='uORoP'></fieldset></dl></div>
                    <tfoot id='uORoP'></tfoot>

                    <legend id='uORoP'><style id='uORoP'><dir id='uORoP'><q id='uORoP'></q></dir></style></legend>

                    <small id='uORoP'></small><noframes id='uORoP'>