<?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[Vergleichen von Vektoren&#x2F;Maps]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich brauche (mal wieder) Hilfe <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>
<p>Zur Situation:<br />
Ich habe zwei Maps die jeweils vom Typ &lt;string, string&gt; sind,<br />
bzw. zwei Vektoren &lt;string&gt; (kommt drauf an wozu ihr mir ratet, kann beides nehmen).</p>
<p>Nun sind in beiden Vektoren minimal 1 und maximal 10-15 Elemente.<br />
Nun möchte ich möglichst performant herausfinden, welche Elemente im einen Vektor sind und im anderen nicht bzw. umgekehrt.</p>
<p>Bsp:<br />
Vektor 1: Name1, Name3, Name4, Name5, Name8<br />
Vektor 2: Name3, Name1, Name6, Name7</p>
<p>Nun soll mir der Code die Elemente von Vektor 1 liefern, die in 2 fehlen<br />
(in diesem Fall also Name4, Name5, Name8)<br />
und danach die Elemente die in Vektor 1 fehlen und in Vektor 2 sind.<br />
(in diesem Fall also Name6, Name7)</p>
<p>Problem ist nur, ich wollte eigentlich nicht hunderte Iterationen machen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Vielen Dank schonmal<br />
Marius</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/73132/vergleichen-von-vektoren-maps</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 14:10:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/73132.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 06 May 2004 13:45:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Vergleichen von Vektoren&#x2F;Maps on Thu, 06 May 2004 13:45:44 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich brauche (mal wieder) Hilfe <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>
<p>Zur Situation:<br />
Ich habe zwei Maps die jeweils vom Typ &lt;string, string&gt; sind,<br />
bzw. zwei Vektoren &lt;string&gt; (kommt drauf an wozu ihr mir ratet, kann beides nehmen).</p>
<p>Nun sind in beiden Vektoren minimal 1 und maximal 10-15 Elemente.<br />
Nun möchte ich möglichst performant herausfinden, welche Elemente im einen Vektor sind und im anderen nicht bzw. umgekehrt.</p>
<p>Bsp:<br />
Vektor 1: Name1, Name3, Name4, Name5, Name8<br />
Vektor 2: Name3, Name1, Name6, Name7</p>
<p>Nun soll mir der Code die Elemente von Vektor 1 liefern, die in 2 fehlen<br />
(in diesem Fall also Name4, Name5, Name8)<br />
und danach die Elemente die in Vektor 1 fehlen und in Vektor 2 sind.<br />
(in diesem Fall also Name6, Name7)</p>
<p>Problem ist nur, ich wollte eigentlich nicht hunderte Iterationen machen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Vielen Dank schonmal<br />
Marius</p>
]]></description><link>https://www.c-plusplus.net/forum/post/515365</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/515365</guid><dc:creator><![CDATA[Croydon]]></dc:creator><pubDate>Thu, 06 May 2004 13:45:44 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleichen von Vektoren&#x2F;Maps on Thu, 06 May 2004 17:22:14 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Vielleicht hilft dir <strong>find_first_not_of</strong>. Das sucht nach dem ersten Element einer Sequenz welches in einer Anderen nicht vorkommt. Dann einfach die Anfangsposition verschieben und so lange weitermachen bis npos kommt.<br />
Am Besten ist es wohl du schaust in die Hilfe dazu.</p>
<p>Ciao</p>
]]></description><link>https://www.c-plusplus.net/forum/post/515504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/515504</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 06 May 2004 17:22:14 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleichen von Vektoren&#x2F;Maps on Thu, 06 May 2004 17:51:04 GMT]]></title><description><![CDATA[<p>es gibt auch std::set_difference der setzt aber voraus, dass die beiden eingabesequenzen sortiert sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/515519</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/515519</guid><dc:creator><![CDATA[japro]]></dc:creator><pubDate>Thu, 06 May 2004 17:51:04 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleichen von Vektoren&#x2F;Maps on Thu, 06 May 2004 19:17:14 GMT]]></title><description><![CDATA[<p>Leider hilft mir beides nicht so unheimlich weiter.<br />
Hab das Ganze jetzt etwas umständlicher gelöst und mache halt ein paar Vergleiche mehr.</p>
<p>Danke dennoch <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/515569</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/515569</guid><dc:creator><![CDATA[Croydon]]></dc:creator><pubDate>Thu, 06 May 2004 19:17:14 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleichen von Vektoren&#x2F;Maps on Thu, 06 May 2004 21:46:28 GMT]]></title><description><![CDATA[<p>Als erstest ordnetst du die Vectoren. Dann fährst mit 2 Iteratoren zu gleichen Zeit über beiden Vectoren. Wenn beide auf den gleichen Wert verweisen gehts du weiter in der Iteration. Wenn die Werte ungleich sind dann ist der Kleiner der beiden Werte nicht in beiden Vectoren. Wenn du am Ende eines Vectors ankommst, dann sind sämtliche Wert die noch im anderen sind nur in dem.<br />
Beispiel:</p>
<p>Vector1:8 5 2 1 6 7 3<br />
Vector2:9 0 7 2 4 9 3<br />
Sortire</p>
<ul>
<li></li>
</ul>
<p>Vector1:1 2 3 5 6 7 8<br />
Vector2:0 2 3 4 7 9 9<br />
Ungleich: 0 fliegt raus</p>
<ul>
<li></li>
</ul>
<p>Vector1:1 2 3 5 6 7 8<br />
Vector2:2 3 4 7 9 9<br />
Ungleich: 1 fliegt raus</p>
<ul>
<li></li>
</ul>
<p>Vector1:2 3 5 6 7 8<br />
Vector2:2 3 4 7 9 9<br />
gleich: gehe weiter</p>
<ul>
<li></li>
</ul>
<p>Vector1:2 3 5 6 7 8<br />
Vector2:2 3 4 7 9 9<br />
gleich: gehe weiter</p>
<ul>
<li></li>
</ul>
<p>Vector1:2 3 5 6 7 8<br />
Vector2:2 3 7 9 9<br />
Ungleich: 4 fliegt raus</p>
<ul>
<li></li>
</ul>
<p>Vector1:2 3 6 7 8<br />
Vector2:2 3 7 9 9<br />
Ungleich: 5 fliegt raus</p>
<ul>
<li></li>
</ul>
<p>Vector1:2 3 7 8<br />
Vector2:2 3 7 9 9<br />
Ungleich: 6 fliegt raus</p>
<ul>
<li></li>
</ul>
<p>Vector1:2 3 7 8<br />
Vector2:2 3 7 9 9<br />
Ungleich: 8 fliegt raus</p>
<ul>
<li></li>
</ul>
<p>Vector1:2 3 7<br />
Vector2:2 3 7 9 9<br />
Ungleich: Am Ende, 9 und 9 fliegen raus</p>
<p>Du hast zwar da nun strings aber man kann auch da ein Vergleichs operator implementire der sie zum Beispiel nach dem Alphabet ordnet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/515674</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/515674</guid><dc:creator><![CDATA[Irgendwer]]></dc:creator><pubDate>Thu, 06 May 2004 21:46:28 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleichen von Vektoren&#x2F;Maps on Fri, 07 May 2004 04:26:05 GMT]]></title><description><![CDATA[<p>das darauf noch niemand angesprungen ist:</p>
<blockquote>
<p>Ich habe zwei Maps die jeweils vom Typ &lt;string, string&gt; sind</p>
</blockquote>
<p>ähm ja, das sieht sehr...effektiv aus, wie willst du denn die strings speichern? beides mal der gleiche string? oder als ersten wert einen anderen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/515701</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/515701</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Fri, 07 May 2004 04:26:05 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleichen von Vektoren&#x2F;Maps on Fri, 07 May 2004 07:13:34 GMT]]></title><description><![CDATA[<p>Zum Ordnen:</p>
<p>Leider &quot;darf&quot; ich die Vektoren nicht ordnen.</p>
<p>Ich habs jetzt einfach mit find gemacht.<br />
Mache also ne Iteration über den ersten Vektor und gucke bei jedem Element obs im zweiten ist.<br />
Das Gleiche mache ich dann mit dem andern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/515748</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/515748</guid><dc:creator><![CDATA[Croydon]]></dc:creator><pubDate>Fri, 07 May 2004 07:13:34 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleichen von Vektoren&#x2F;Maps on Fri, 07 May 2004 08:42:43 GMT]]></title><description><![CDATA[<p>Wenn du die Orginalvektoren nicht ordnen darfst, dann mach doch Kopien und ordne die.<br />
Ach so das mit find_first_not_of kann man auch vergessen. Beim genauen Hinschauen hab ich gesehen, dass es die nur für string gibt. Für Container gibt es hier nur find_first_of.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/515795</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/515795</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Fri, 07 May 2004 08:42:43 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleichen von Vektoren&#x2F;Maps on Fri, 07 May 2004 18:21:40 GMT]]></title><description><![CDATA[<p>Ich will ja nichts sagen, aber std::map ist immer sortiert. <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="🙄"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/516205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/516205</guid><dc:creator><![CDATA[Helium]]></dc:creator><pubDate>Fri, 07 May 2004 18:21:40 GMT</pubDate></item></channel></rss>