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

      <tfoot id='kz1lE'></tfoot>
      • <bdo id='kz1lE'></bdo><ul id='kz1lE'></ul>

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

        迭代 std::set/std::map 的时间复杂度是多少?

        What#39;s the time complexity of iterating through a std::set/std::map?(迭代 std::set/std::map 的时间复杂度是多少?)
        <legend id='RCMpn'><style id='RCMpn'><dir id='RCMpn'><q id='RCMpn'></q></dir></style></legend>
          <tbody id='RCMpn'></tbody>
          • <bdo id='RCMpn'></bdo><ul id='RCMpn'></ul>
            <tfoot id='RCMpn'></tfoot>
          • <i id='RCMpn'><tr id='RCMpn'><dt id='RCMpn'><q id='RCMpn'><span id='RCMpn'><b id='RCMpn'><form id='RCMpn'><ins id='RCMpn'></ins><ul id='RCMpn'></ul><sub id='RCMpn'></sub></form><legend id='RCMpn'></legend><bdo id='RCMpn'><pre id='RCMpn'><center id='RCMpn'></center></pre></bdo></b><th id='RCMpn'></th></span></q></dt></tr></i><div id='RCMpn'><tfoot id='RCMpn'></tfoot><dl id='RCMpn'><fieldset id='RCMpn'></fieldset></dl></div>

              1. <small id='RCMpn'></small><noframes id='RCMpn'>

                • 本文介绍了迭代 std::set/std::map 的时间复杂度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  遍历 std::set/std::multiset/std::map/ 的时间复杂度是多少std::multimap?我相信它在集合/地图的大小上是线性的,但不太确定.语言标准里有规定吗?

                  What's the time complexity of iterating through a std::set/std::multiset/std::map/std::multimap? I believe that it is linear in the size of the set/map, but not so sure. Is it specified in the language standard?

                  推荐答案

                  在 草案 C++11 标准 N3337 答案可以在 § 24.2.1 第 8 段中找到:

                  In the draft C++11 standard N3337 the answer can be found in § 24.2.1 paragraph 8:

                  所有类别的迭代器只需要那些可在固定时间内实现给定类别(摊销).

                  All the categories of iterators require only those functions that are realizable for a given category in constant time (amortized).

                  由于对迭代器的每次操作都必须是常数时间,因此遍历n 个元素必须是O(n).

                  Since each operation on an iterator must be constant time, iterating through n elements must be O(n).

                  这篇关于迭代 std::set/std::map 的时间复杂度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is the past-the-end iterator in STL C++?(STL C++ 中的最后迭代器是什么?)
                  vector::at vs. vector::operator[](vector::at 与 vector::operator[])
                  C++ equivalent of StringBuffer/StringBuilder?(C++ 等效于 StringBuffer/StringBuilder?)
                  Adding types to the std namespace(将类型添加到 std 命名空间)
                  Is the C++ std::set thread-safe?(C++ std::set 线程安全吗?)
                  How to use std::find/std::find_if with a vector of custom class objects?(如何将 std::find/std::find_if 与自定义类对象的向量一起使用?)
                    <bdo id='ABZc0'></bdo><ul id='ABZc0'></ul>

                      • <legend id='ABZc0'><style id='ABZc0'><dir id='ABZc0'><q id='ABZc0'></q></dir></style></legend>

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

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