<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 的时间复杂度是多少?

        时间:2024-05-11
        <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 的时间复杂度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用 std::copy 将一张地图复制到另一张地图? 下一篇:在 openmp 中迭代 std 容器

                  相关文章

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

                  1. <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>
                  2. <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>