<?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[Laufzeit von STL vector sort()]]></title><description><![CDATA[<p>Hallo!!</p>
<p>Habe da mal eine Frage. Was ist der Worst Case für vector sort und welcher Algorithmus wird da verwendet?</p>
<p>Merci</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/125421/laufzeit-von-stl-vector-sort</link><generator>RSS for Node</generator><lastBuildDate>Mon, 24 Aug 2026 07:31:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/125421.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 06 Nov 2005 15:15:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 15:15:59 GMT]]></title><description><![CDATA[<p>Hallo!!</p>
<p>Habe da mal eine Frage. Was ist der Worst Case für vector sort und welcher Algorithmus wird da verwendet?</p>
<p>Merci</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909586</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909586</guid><dc:creator><![CDATA[Speeder]]></dc:creator><pubDate>Sun, 06 Nov 2005 15:15:59 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 15:23:01 GMT]]></title><description><![CDATA[<p><a href="http://www.cppreference.com/cppalgorithm/sort.html" rel="nofollow">http://www.cppreference.com/cppalgorithm/sort.html</a>.</p>
<p>Btw: std::vector besitzt keine sort-methode.</p>
<p>Gruß Caipi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909593</guid><dc:creator><![CDATA[Caipi]]></dc:creator><pubDate>Sun, 06 Nov 2005 15:23:01 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 15:43:04 GMT]]></title><description><![CDATA[<p>vector hat keine eigene sort-Funktion, ich nehme also an du meinst sort() aus<br />
&lt;algorithm&gt;.<br />
Für sort() schreibt der Standard eine AV-Komplexität von:<br />
- O(n*log(n))<br />
vor, aber nicht welcher Algorithmus verwendet werden MUSS. Die WC-Komplexität<br />
kann daher nur für jede Implementierung extra angegeben werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909613</guid><dc:creator><![CDATA[Redhead]]></dc:creator><pubDate>Sun, 06 Nov 2005 15:43:04 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 16:56:39 GMT]]></title><description><![CDATA[<p>ich denke mal es ist fast immer quick-sort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909702</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909702</guid><dc:creator><![CDATA[ratefuchs]]></dc:creator><pubDate>Sun, 06 Nov 2005 16:56:39 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 17:09:38 GMT]]></title><description><![CDATA[<p>Ich denke, es ist meistens ein Quicksort, der bei einer bestimmten Kleinheit des Teilintervalls dann einen anderen Algorithmus bemüht, z.B. InsertionSort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909710</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909710</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 06 Nov 2005 17:09:38 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 17:23:48 GMT]]></title><description><![CDATA[<p>warum glaubt ihr nicht wie im link angegeben an intro-sort?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909721</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909721</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sun, 06 Nov 2005 17:23:48 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 17:29:06 GMT]]></title><description><![CDATA[<p>Was schreiben die denn da für einen Müll auf <a href="http://cppreference.com" rel="nofollow">cppreference.com</a>? Das ist doch gar nicht im Standard vereinbart.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909734</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909734</guid><dc:creator><![CDATA[............]]></dc:creator><pubDate>Sun, 06 Nov 2005 17:29:06 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 17:33:11 GMT]]></title><description><![CDATA[<p>algorithm aus visual c++ 7.1 nutzt quicksort</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909742</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909742</guid><dc:creator><![CDATA[............]]></dc:creator><pubDate>Sun, 06 Nov 2005 17:33:11 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 17:37:52 GMT]]></title><description><![CDATA[<p>sorry stimmt nicht so ganz. so weit ich sehe quicksort, heap sort und insertion sort</p>
<pre><code class="language-cpp">template&lt;class _RanIt,
	class _Diff,
	class _Pr&gt; inline
	void _Sort(_RanIt _First, _RanIt _Last, _Diff _Ideal, _Pr _Pred)
	{	// order [_First, _Last), using _Pred
	_Diff _Count;
	for (; _ISORT_MAX &lt; (_Count = _Last - _First) &amp;&amp; 0 &lt; _Ideal; )
		{	// divide and conquer by quicksort
		pair&lt;_RanIt, _RanIt&gt; _Mid =
			_Unguarded_partition(_First, _Last, _Pred);
		_Ideal /= 2, _Ideal += _Ideal / 2;	// allow 1.5 log2(N) divisions

		if (_Mid.first - _First &lt; _Last - _Mid.second)	// loop on larger half
			_Sort(_First, _Mid.first, _Ideal, _Pred), _First = _Mid.second;
		else
			_Sort(_Mid.second, _Last, _Ideal, _Pred), _Last = _Mid.first;
		}

	if (_ISORT_MAX &lt; _Count)
		{	// heap sort if too many divisions
		std::make_heap(_First, _Last, _Pred);
		std::sort_heap(_First, _Last, _Pred);
		}
	else if (1 &lt; _Count)
		_Insertion_sort(_First, _Last, _Pred);	// small, insertion sort
	}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/909750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909750</guid><dc:creator><![CDATA[..........]]></dc:creator><pubDate>Sun, 06 Nov 2005 17:37:52 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 17:42:32 GMT]]></title><description><![CDATA[<p>............ schrieb:</p>
<blockquote>
<p>Was schreiben die denn da für einen Müll auf <a href="http://cppreference.com" rel="nofollow">cppreference.com</a>? Das ist doch gar nicht im Standard vereinbart.</p>
</blockquote>
<p><strong>Nochmal</strong>, der Standard gibt Komplexitätsgarantien, schreibt aber keine Implementierung vor.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909753</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909753</guid><dc:creator><![CDATA[Redhead]]></dc:creator><pubDate>Sun, 06 Nov 2005 17:42:32 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 17:51:18 GMT]]></title><description><![CDATA[<p>.......... schrieb:</p>
<blockquote>
<p>sorry stimmt nicht so ganz. so weit ich sehe quicksort, heap sort und insertion sort</p>
</blockquote>
<p>schau mal ganz genau, ob es nicht doch introsort ist. introsort benutzt nämlich normalerweise quicksort, heap sort und insertion sort.</p>
<p>edit: naja, schau einfach nur auf die schleife</p>
<pre><code class="language-cpp">for (; _ISORT_MAX &lt; (_Count = _Last - _First) &amp;&amp; 0 &lt; _Ideal; )
</code></pre>
<p>ja, der standfard definiert nur komplexitätsgarantien, aber das ändert nichts daran, daß man als user ruhig von introsort ausgehen sollte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/909759</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909759</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sun, 06 Nov 2005 17:51:18 GMT</pubDate></item><item><title><![CDATA[Reply to Laufzeit von STL vector sort() on Sun, 06 Nov 2005 17:49:48 GMT]]></title><description><![CDATA[<p>Jo, deswegen hat sich ...... ja auch gewundert, was da bei cppreference steht. Aber gut, daß Du dein nochmal Fett gesetzt hast. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/909760</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/909760</guid><dc:creator><![CDATA[Jester]]></dc:creator><pubDate>Sun, 06 Nov 2005 17:49:48 GMT</pubDate></item></channel></rss>