<?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[sortieren]]></title><description><![CDATA[<p>Hi</p>
<p>Ich hoffe ich bin im richtigen Forum.<br />
Ich hab ein kleines Problemchen und habe gehofft ihr könnt mir dabei helfen:<br />
Ich habe zwei Felder zu je 10 elementen zu einem feld zu 20 elementen zusammengefügt,leider will ich jetzt auch noch das große feld sortieren und weiss nicht wie.<br />
Bitte um Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/243207/sortieren</link><generator>RSS for Node</generator><lastBuildDate>Sun, 20 Sep 2026 04:48:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/243207.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 14 Jun 2009 08:05:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to sortieren on Sun, 14 Jun 2009 08:05:36 GMT]]></title><description><![CDATA[<p>Hi</p>
<p>Ich hoffe ich bin im richtigen Forum.<br />
Ich hab ein kleines Problemchen und habe gehofft ihr könnt mir dabei helfen:<br />
Ich habe zwei Felder zu je 10 elementen zu einem feld zu 20 elementen zusammengefügt,leider will ich jetzt auch noch das große feld sortieren und weiss nicht wie.<br />
Bitte um Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1726230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1726230</guid><dc:creator><![CDATA[typdom]]></dc:creator><pubDate>Sun, 14 Jun 2009 08:05:36 GMT</pubDate></item><item><title><![CDATA[Reply to sortieren on Sun, 14 Jun 2009 08:15:49 GMT]]></title><description><![CDATA[<p>mergesort</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1726232</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1726232</guid><dc:creator><![CDATA[umean?]]></dc:creator><pubDate>Sun, 14 Jun 2009 08:15:49 GMT</pubDate></item><item><title><![CDATA[Reply to sortieren on Sun, 14 Jun 2009 08:21:48 GMT]]></title><description><![CDATA[<p>mergesort?<br />
Tut mir leid aber diesen Ausdruck kenne ich nicht.<br />
Ich möchte in meinem feld [20] die Zahlen sortieren z.b.<br />
2 34 23 24 25 36 1 3 23 45 46 12 13 14 16 17 19 20 21 20</p>
<p>soll dann so aussehen: 1 2 3 12 13 14 16 17 19 20 20 21 23 23 24 25 36 45 46</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1726234</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1726234</guid><dc:creator><![CDATA[typdom]]></dc:creator><pubDate>Sun, 14 Jun 2009 08:21:48 GMT</pubDate></item><item><title><![CDATA[Reply to sortieren on Sun, 14 Jun 2009 08:37:55 GMT]]></title><description><![CDATA[<p><a href="https://www.google.de/search?&amp;q=quicksort" rel="nofollow">Google: quicksort</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1726240</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1726240</guid><dc:creator><![CDATA[umean]]></dc:creator><pubDate>Sun, 14 Jun 2009 08:37:55 GMT</pubDate></item><item><title><![CDATA[Reply to sortieren on Sun, 14 Jun 2009 08:38:17 GMT]]></title><description><![CDATA[<p>typdom schrieb:</p>
<blockquote>
<p>mergesort?<br />
Tut mir leid aber diesen Ausdruck kenne ich nicht.</p>
</blockquote>
<p>Dann such danach. Deine Lieblingssuchemaschine oder Wikipedia geben da sicher eine Antwort. Ich hänge mal einen Link nach Wikipedia rein, wo du auch noch sonstige Informationen ausser Mergesort hast:<br />
<a href="http://de.wikipedia.org/wiki/Sortierverfahren" rel="nofollow">http://de.wikipedia.org/wiki/Sortierverfahren</a></p>
<p>Es gäbe auch direkt von der Standardbibliothek in C++ Sortierverfahren:<br />
<a href="http://www.cplusplus.com/reference/algorithm/" rel="nofollow">http://www.cplusplus.com/reference/algorithm/</a></p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1726241</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1726241</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Sun, 14 Jun 2009 08:38:17 GMT</pubDate></item><item><title><![CDATA[Reply to sortieren on Sun, 14 Jun 2009 09:03:04 GMT]]></title><description><![CDATA[<p>danke für die hilfe<br />
ich habs so gelöst:</p>
<p>for(l=0;l&lt;=20;l++)<br />
{<br />
for(k=0;k&lt;=19;k++)<br />
{<br />
if(feld3[k]&gt;feld3[k+1])<br />
{<br />
help = feld3[k];<br />
feld3[k] = feld3[k+1];<br />
feld3[k+1] = help;<br />
}<br />
}<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1726247</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1726247</guid><dc:creator><![CDATA[typdom]]></dc:creator><pubDate>Sun, 14 Jun 2009 09:03:04 GMT</pubDate></item><item><title><![CDATA[Reply to sortieren on Sun, 14 Jun 2009 09:17:38 GMT]]></title><description><![CDATA[<p>typdom schrieb:</p>
<blockquote>
<p>danke für die hilfe<br />
ich habs so gelöst:</p>
<pre><code class="language-cpp">for(l=0;l&lt;=20;l++)
	{
		for(k=0;k&lt;=19;k++)
		{
			if(feld3[k]&gt;feld3[k+1])
			{
				help = feld3[k];
				feld3[k] = feld3[k+1];
				feld3[k+1] = help;
			}
		}
}
</code></pre>
</blockquote>
<p>Aber äußerst ineffektiv.</p>
<ol>
<li>beim allerersten Vergleich vergleichst du efld3[0] mit feld3[0] doof, oder?</li>
<li>Du startest bei idx 0. Diesen Wert vergleichst du mit den restlichen Werten der Liste. Am Ende des ersten Durchlaufs kannst du davon ausgehen, dass an idx=0 der kleinste Wert deiner Liste liegt. Dies läßt sich auch auf l=1, l=2, ... l=19 ausweiten.</li>
</ol>
<p>Ergo die bessere Alternative:</p>
<pre><code class="language-cpp">for( int i=0; i&lt;len-1; i++ ) {
    for( int j=i+1; j&lt;len; j++ ) {
        if( liste[j] &lt; liste[i] ) {
            swap( liste, i, j );
        }
    }
}
</code></pre>
<p>Die beste Lösung wäre aber, gleich std::vector zu verwenden und einen Sortieralgorithmus aus std::algorithms zu nehmen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1726251</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1726251</guid><dc:creator><![CDATA[schrulle]]></dc:creator><pubDate>Sun, 14 Jun 2009 09:17:38 GMT</pubDate></item><item><title><![CDATA[Reply to sortieren on Sun, 14 Jun 2009 09:38:41 GMT]]></title><description><![CDATA[<p>Last mal es mal langsam angehen.<br />
Der Beitragsteller ist wahrscheinlich ein C++ Anfänger.<br />
Ihr fahrt doch auch bei eurer erste Fahrstunde auf dem Nürburgring.</p>
<p>Was man natürlich anmerken kann - das Forum hier wird problemlos gefunden -<br />
und bei der Suche nach dem Sortieralgorhythmus, der namentlich genannt wird, hat man Schwierigkeiten?</p>
<p>MfG f.-th.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1726263</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1726263</guid><dc:creator><![CDATA[f.-th.]]></dc:creator><pubDate>Sun, 14 Jun 2009 09:38:41 GMT</pubDate></item></channel></rss>