<?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[array.has(...)??]]></title><description><![CDATA[<p>hallo zusammen,</p>
<p>ich bin gerade dabei, nen paar alte python-scripte in cpp umzusetzen (zur übung), wobei mir eins fehlte:</p>
<p>kann man wenn man mit<br />
int mein_array[] = (1,3,4,5);<br />
irgendwie SCHNELL (also ohne for (int i=0;, ...) )<br />
herausfinden, ob ein array ein element (zb. 3) enthält?</p>
<p>ich wusste leider wirklich nicht, wonach ich in diesem fall suchen sollte,<br />
da sowas in python immer mit<br />
for i in mein_array:<br />
...<br />
gelöst wurde.</p>
<p>dankeschön im voraus und<br />
liebe grüße<br />
hannes</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/144793/array-has</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 18:41:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/144793.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Apr 2006 18:16:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to array.has(...)?? on Fri, 21 Apr 2006 18:16:54 GMT]]></title><description><![CDATA[<p>hallo zusammen,</p>
<p>ich bin gerade dabei, nen paar alte python-scripte in cpp umzusetzen (zur übung), wobei mir eins fehlte:</p>
<p>kann man wenn man mit<br />
int mein_array[] = (1,3,4,5);<br />
irgendwie SCHNELL (also ohne for (int i=0;, ...) )<br />
herausfinden, ob ein array ein element (zb. 3) enthält?</p>
<p>ich wusste leider wirklich nicht, wonach ich in diesem fall suchen sollte,<br />
da sowas in python immer mit<br />
for i in mein_array:<br />
...<br />
gelöst wurde.</p>
<p>dankeschön im voraus und<br />
liebe grüße<br />
hannes</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1042170</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1042170</guid><dc:creator><![CDATA[Hannes-Spz]]></dc:creator><pubDate>Fri, 21 Apr 2006 18:16:54 GMT</pubDate></item><item><title><![CDATA[Reply to array.has(...)?? on Fri, 21 Apr 2006 18:30:33 GMT]]></title><description><![CDATA[<p>Wenn das Array nicht gerade sortiert ist, wie willst du ohne Durchlaufen feststellen, ob ein Element im Array ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1042180</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1042180</guid><dc:creator><![CDATA[Ponto]]></dc:creator><pubDate>Fri, 21 Apr 2006 18:30:33 GMT</pubDate></item><item><title><![CDATA[Reply to array.has(...)?? on Fri, 21 Apr 2006 18:42:14 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>sieh zum Beispiel <a href="http://www.cppreference.com/cppalgorithm/find.html" rel="nofollow">std::find</a>, was intern natürlich auch bloß eine Schleife abläft.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1042181</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1042181</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Fri, 21 Apr 2006 18:42:14 GMT</pubDate></item><item><title><![CDATA[Reply to array.has(...)?? on Sat, 22 Apr 2006 08:19:05 GMT]]></title><description><![CDATA[<p>Wenn du sicherstellen kannst, daß dein Array sortiert ist, funktioniert auch std::binary_search() (liefert eine Ja/Nein-Entscheidung) oder std::lower_bound() (liefert die Position des gesuchten Elements) - beide haben eine Laufzeit von O(log n).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1042385</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1042385</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sat, 22 Apr 2006 08:19:05 GMT</pubDate></item></channel></rss>