<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[C++ Container]]></title><description><![CDATA[<p>Guten Morgen,<br />
eine kurze Frage: Sind alle STL-Containr (deque,list,stack,vector,map,set...) dynamisch? Ich kann also die Größe aller Container zur Laufzeit anpassen?</p>
<p>Danke euch. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/308041/c-container</link><generator>RSS for Node</generator><lastBuildDate>Thu, 06 Aug 2026 03:00:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/308041.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 13 Sep 2012 07:39:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 07:39:40 GMT]]></title><description><![CDATA[<p>Guten Morgen,<br />
eine kurze Frage: Sind alle STL-Containr (deque,list,stack,vector,map,set...) dynamisch? Ich kann also die Größe aller Container zur Laufzeit anpassen?</p>
<p>Danke euch. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250835</guid><dc:creator><![CDATA[C++ Container]]></dc:creator><pubDate>Thu, 13 Sep 2012 07:39:40 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 07:49:55 GMT]]></title><description><![CDATA[<p><a href="http://www.cplusplus.com/reference/stl/" rel="nofollow">RTFM</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250839</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250839</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Thu, 13 Sep 2012 07:49:55 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 08:32:42 GMT]]></title><description><![CDATA[<p>In C++11 gibt es den Container std::array mit einer fixen Größe und std::bitset hat auch eine fixe Größe. Ansonsten sind die Container dynamisch.</p>
<p>Tachyon schrieb:</p>
<blockquote>
<p><a href="http://www.cplusplus.com/reference/stl/" rel="nofollow">RTFM</a></p>
</blockquote>
<p>Neeee, lieber <a href="http://en.cppreference.com/w/" rel="nofollow">http://en.cppreference.com/w/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250847</guid><dc:creator><![CDATA[rüdiger]]></dc:creator><pubDate>Thu, 13 Sep 2012 08:32:42 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 09:13:36 GMT]]></title><description><![CDATA[<p>rüdiger schrieb:</p>
<blockquote>
<p>In C++11 gibt es den Container std::array mit einer fixen Größe und std::bitset hat auch eine fixe Größe. Ansonsten sind die Container dynamisch.</p>
</blockquote>
<p>Aber im Gegensatz zu C-Arrays muss bei std::array und std::bitset die Größe nicht zur Compilezeit feststehen (oder habe ich das falsch verstanden?)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250857</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250857</guid><dc:creator><![CDATA[daddy_felix]]></dc:creator><pubDate>Thu, 13 Sep 2012 09:13:36 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 09:17:21 GMT]]></title><description><![CDATA[<p>daddy_felix schrieb:</p>
<blockquote>
<p>rüdiger schrieb:</p>
<blockquote>
<p>In C++11 gibt es den Container std::array mit einer fixen Größe und std::bitset hat auch eine fixe Größe. Ansonsten sind die Container dynamisch.</p>
</blockquote>
<p>Aber im Gegensatz zu C-Arrays muss bei std::array und std::bitset die Größe nicht zur Compilezeit feststehen (oder habe ich das falsch verstanden?)</p>
</blockquote>
<p>Doch, müssen sie. Weil die Größe ist für beide Container ein Template Parameter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250859</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250859</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Thu, 13 Sep 2012 09:17:21 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 09:28:50 GMT]]></title><description><![CDATA[<p>rüdiger schrieb:</p>
<blockquote>
<p>Neeee, lieber <a href="http://en.cppreference.com/w/" rel="nofollow">http://en.cppreference.com/w/</a></p>
</blockquote>
<p>Warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250864</guid><dc:creator><![CDATA[Fragesteller123]]></dc:creator><pubDate>Thu, 13 Sep 2012 09:28:50 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 09:30:40 GMT]]></title><description><![CDATA[<p>Shade Of Mine schrieb:</p>
<blockquote>
<p>Doch, müssen sie. Weil die Größe ist für beide Container ein Template Parameter.</p>
</blockquote>
<p>Achso, ok. Danke <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250866</guid><dc:creator><![CDATA[daddy_felix]]></dc:creator><pubDate>Thu, 13 Sep 2012 09:30:40 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 09:55:01 GMT]]></title><description><![CDATA[<p>Fragesteller123 schrieb:</p>
<blockquote>
<p>Warum?</p>
</blockquote>
<p>Weil cppreference im Gegensatz zu cplusplus auch C++11 enthält.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250873</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Thu, 13 Sep 2012 09:55:01 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 11:02:17 GMT]]></title><description><![CDATA[<p>Danke euch. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Noch eine Frage: Bei z.B. std::set::find steht unten: <code>Logarithmic in the size of the container.</code> Auf welche Basis bezieht sich das? e? 10?</p>
<p>Danke nochmals. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250894</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250894</guid><dc:creator><![CDATA[C++ Container]]></dc:creator><pubDate>Thu, 13 Sep 2012 11:02:17 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 11:16:59 GMT]]></title><description><![CDATA[<p>Auf Basis 2</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250904</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250904</guid><dc:creator><![CDATA[Achso]]></dc:creator><pubDate>Thu, 13 Sep 2012 11:16:59 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 11:21:19 GMT]]></title><description><![CDATA[<p>Prinzipiell ist die Basis da eigentlich egal, diese Aussage soll eher die grundsätzliche Komplexität angeben - die mit der Anzahl der Elemente eben logarithmisch, d.h. &quot;langsam&quot; wächst. D.h. mutlipliziert man die Anzahl der Elemente mit einem Wert x, steigt der Aufwand nur um einen (immer festen) Wert y.<br />
set verwendet ein binäre Suche, also wenn du eine spezielle Basis wissen willst wärs wohl die 2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250907</guid><dc:creator><![CDATA[KMT]]></dc:creator><pubDate>Thu, 13 Sep 2012 11:21:19 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 11:24:10 GMT]]></title><description><![CDATA[<p>KMT schrieb:</p>
<blockquote>
<p>set verwendet ein binäre Suche, also wenn du eine spezielle Basis wissen willst wärs wohl die 2.</p>
</blockquote>
<p>omg, darauf hätte ich selbst kommen können, danke dir trotzdem. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250909</guid><dc:creator><![CDATA[C++ Container]]></dc:creator><pubDate>Thu, 13 Sep 2012 11:24:10 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 11:29:25 GMT]]></title><description><![CDATA[<p>Die Basis spielt keine Rolle, weil sie im konstanten Vorfaktor untergeht: <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>log</mi><mi mathvariant="normal">_</mi><mi>a</mi><mi>x</mi><mo>=</mo><mfrac><mrow><mi>log</mi><mi mathvariant="normal">_</mi><mi>b</mi><mi>x</mi></mrow><mrow><msub><mi>log</mi><mi>b</mi></msub><mi>a</mi></mrow></mfrac></mrow><annotation encoding="application/x-tex">\log\_a x = \frac{\log\_b x}{\log_b a}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:1.013108em;"></span><span class="strut bottom" style="height:1.529216em;vertical-align:-0.516108em;"></span><span class="base textstyle uncramped"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit">a</span><span class="mord mathit">x</span><span class="mrel">=</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.34500000000000003em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mop"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="vlist"><span style="top:0.24444em;margin-right:0.07142857142857144em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-scriptstyle scriptscriptstyle cramped"><span class="mord mathit">b</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="mord mathit">a</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.527em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit">b</span><span class="mord mathit">x</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span></span></span></span></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2250912</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2250912</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Thu, 13 Sep 2012 11:29:25 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 19:34:38 GMT]]></title><description><![CDATA[<p>Bashar schrieb:</p>
<blockquote>
<p>Die Basis spielt keine Rolle, weil sie im konstanten Vorfaktor untergeht: <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>log</mi><mi mathvariant="normal">_</mi><mi>a</mi><mi>x</mi><mo>=</mo><mfrac><mrow><mi>log</mi><mi mathvariant="normal">_</mi><mi>b</mi><mi>x</mi></mrow><mrow><msub><mi>log</mi><mi>b</mi></msub><mi>a</mi></mrow></mfrac></mrow><annotation encoding="application/x-tex">\log\_a x = \frac{\log\_b x}{\log_b a}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:1.013108em;"></span><span class="strut bottom" style="height:1.529216em;vertical-align:-0.516108em;"></span><span class="base textstyle uncramped"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit">a</span><span class="mord mathit">x</span><span class="mrel">=</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.34500000000000003em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mop"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="vlist"><span style="top:0.24444em;margin-right:0.07142857142857144em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-scriptstyle scriptscriptstyle cramped"><span class="mord mathit">b</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="mord mathit">a</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.527em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit">b</span><span class="mord mathit">x</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span></span></span></span></p>
</blockquote>
<p>Kannst du mir das näher erklären, bitte?</p>
<p>Angenommen ich habe ein vector mit 4 Mrd. Elementen und suche das letzte Elemente. Dafür brauche ich z.B. 3 Sekunden.<br />
Angenommen ich nehme dann ein set mit 4 Mrd. Elementen und suche das unterste Blatt im Binärbaum. Dafür brauche ich z.B. 500 ms.</p>
<p>Dann mache ich das Ganze mit 2 Mrd. Elementen.<br />
Dann brauche ich z.B. mit vector noch 1,5 Sekunden und mit set noch 250 ms.</p>
<p>Ahhh, ich glaube ich hab Gerade ein AHA-EFFEKT. Wenn ich nun bei set <code>logb(4mrd.) / logb(2mrd.)</code> rechne, spielt die Basis keine Roll mehr. Wolltest du mir das sagen, Bashar? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2251103</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2251103</guid><dc:creator><![CDATA[STL Container]]></dc:creator><pubDate>Thu, 13 Sep 2012 19:34:38 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 19:36:22 GMT]]></title><description><![CDATA[<p>ich meinte natürlich: <code>logb(500) / logb(250)</code></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2251105</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2251105</guid><dc:creator><![CDATA[STL Container]]></dc:creator><pubDate>Thu, 13 Sep 2012 19:36:22 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 20:15:23 GMT]]></title><description><![CDATA[<p>Naja, ne, du brauchst ja gerade nicht 250ms statt 500ms sondern eher ca. 484ms.<br />
(Wobei 500ms unrealistisch lange ist)</p>
<p>Und ne, <code>log(4Mrd.)/log(2Mrd.)</code> wäre schon richtig gewesen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2251121</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2251121</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Thu, 13 Sep 2012 20:15:23 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Container on Thu, 13 Sep 2012 23:10:14 GMT]]></title><description><![CDATA[<p>STL Container schrieb:</p>
<blockquote>
<p>Bashar schrieb:</p>
<blockquote>
<p>Die Basis spielt keine Rolle, weil sie im konstanten Vorfaktor untergeht: <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>log</mi><mi mathvariant="normal">_</mi><mi>a</mi><mi>x</mi><mo>=</mo><mfrac><mrow><mi>log</mi><mi mathvariant="normal">_</mi><mi>b</mi><mi>x</mi></mrow><mrow><msub><mi>log</mi><mi>b</mi></msub><mi>a</mi></mrow></mfrac></mrow><annotation encoding="application/x-tex">\log\_a x = \frac{\log\_b x}{\log_b a}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:1.013108em;"></span><span class="strut bottom" style="height:1.529216em;vertical-align:-0.516108em;"></span><span class="base textstyle uncramped"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit">a</span><span class="mord mathit">x</span><span class="mrel">=</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.34500000000000003em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mop"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="vlist"><span style="top:0.24444em;margin-right:0.07142857142857144em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-scriptstyle scriptscriptstyle cramped"><span class="mord mathit">b</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="mord mathit">a</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.527em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit">b</span><span class="mord mathit">x</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span></span></span></span></p>
</blockquote>
<p>Kannst du mir das näher erklären, bitte?</p>
</blockquote>
<p>Kennst du die O-Notation? Ohne das jetzt genauer (und richtiger) zu erklären, heißt &quot;Elementzugriff bei std::set hat eine Laufzeit von O(log n)&quot;, dass der tatsächliche Laufzeitbedarf eher sowas wie K*log(n) + Kleinkram ist. Die O-Notation abstrahiert den Vorfaktor K sowie die anderen Terme, die in dem Fall vom Logarithmus dominiert werden, weg. (Und jetzt lies es nochmal bei Wikipedia oder in einem Algorithmenlehrbuch nach.)</p>
<p>Das ist schon deshalb sinnvoll, weil ein Algorithmus nicht besser wird, bloß weil du einen doppelt so schnellen Rechner kaufst. Da ist dann der konstante Vorfaktor nur noch halb so groß, aber an der Aussage O(log n) ändert sich nichts.</p>
<p>Wenn du jetzt die Basis des Logarithmus änderst, dann kommt ein zusätzlicher Faktor dazu (siehe mein obiges Zitat), der mit dem schon vorhandenen Faktor zu einem verschmilzt und bei der O-Notation sowieso wegfällt. Das heißt alle Klassen <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>O</mi><mo>(</mo><msub><mi>log</mi><mi>b</mi></msub><mi>n</mi><mo>)</mo></mrow><annotation encoding="application/x-tex">O(\log_b n)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mop"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="vlist"><span style="top:0.24444em;margin-right:0.05em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord mathit">b</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="mord mathit">n</span><span class="mclose">)</span></span></span></span> sind gleich, und deshalb kann man das b auch weglassen.</p>
<blockquote>
<p>Ahhh, ich glaube ich hab Gerade ein AHA-EFFEKT. Wenn ich nun bei set <code>logb(4mrd.) / logb(2mrd.)</code> rechne, spielt die Basis keine Roll mehr. Wolltest du mir das sagen, Bashar? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
</blockquote>
<p>Nicht direkt, aber das kommt ungefähr auf das gleiche raus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2251148</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2251148</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Thu, 13 Sep 2012 23:10:14 GMT</pubDate></item></channel></rss>