<?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[Algorithm to find all possible combinations]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I'm need to find every combinations following this explanation :</p>
<p dir="auto">I have 4 lists :<br />
1st list : (A,B)<br />
2nd list (C,D)<br />
3rd list (E,F)<br />
4th list (G,H)</p>
<p dir="auto">The result should be :</p>
<p dir="auto">Only 1 from the first list<br />
Only 1 from the second list<br />
None to all from the third<br />
Only one from the fourth list</p>
<p dir="auto">Examples :<br />
A + C+ G<br />
A +C + E,F + H<br />
B+ D + F + G</p>
<p dir="auto">How can I find all those combinations ?<br />
Not sure to be very clear here so if I'm not please ask me.</p>
]]></description><link>https://forum.qt.io/topic/95201/algorithm-to-find-all-possible-combinations</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 04:32:51 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/95201.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 02 Oct 2018 13:32:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Algorithm to find all possible combinations on Wed, 31 Oct 2018 23:29:06 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://en.wikipedia.org/wiki/Constraint_programming" target="_blank" rel="noopener noreferrer nofollow ugc">https://en.wikipedia.org/wiki/Constraint_programming</a> and <a href="https://en.wikipedia.org/wiki/Gecode" target="_blank" rel="noopener noreferrer nofollow ugc">https://en.wikipedia.org/wiki/Gecode</a>?</p>
]]></description><link>https://forum.qt.io/post/490473</link><guid isPermaLink="true">https://forum.qt.io/post/490473</guid><dc:creator><![CDATA[Eeli K]]></dc:creator><pubDate>Wed, 31 Oct 2018 23:29:06 GMT</pubDate></item><item><title><![CDATA[Reply to Algorithm to find all possible combinations on Tue, 02 Oct 2018 14:54:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a></p>
<blockquote>
<p dir="auto">BTW, my old favorite Prolog language would be better than C++ for this :) No loops!</p>
</blockquote>
<p dir="auto">I don't doubt that! However, even in C++ might be better approaches - my solution is a very simple one.</p>
<p dir="auto">I'm sure deep in the STL or an external library there is an algorithm for such problems - but that's just outside my normal work area.</p>
]]></description><link>https://forum.qt.io/post/484859</link><guid isPermaLink="true">https://forum.qt.io/post/484859</guid><dc:creator><![CDATA[aha_1980]]></dc:creator><pubDate>Tue, 02 Oct 2018 14:54:56 GMT</pubDate></item><item><title><![CDATA[Reply to Algorithm to find all possible combinations on Tue, 02 Oct 2018 14:52:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/davidm29">@<bdi>DavidM29</bdi></a><br />
And make sure you end up with 32 combinations, exactly as per <a class="plugin-mentions-user plugin-mentions-a" href="/user/aha_1980">@<bdi>aha_1980</bdi></a>'s algorithm :-;</p>
<p dir="auto">BTW, my old favorite Prolog language would be better than C++ for this :)  No loops!</p>
]]></description><link>https://forum.qt.io/post/484858</link><guid isPermaLink="true">https://forum.qt.io/post/484858</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 02 Oct 2018 14:52:28 GMT</pubDate></item><item><title><![CDATA[Reply to Algorithm to find all possible combinations on Tue, 02 Oct 2018 14:50:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aha_1980">@<bdi>aha_1980</bdi></a><br />
Thank you for your reply I'll do that. I don't need the F,E.</p>
]]></description><link>https://forum.qt.io/post/484857</link><guid isPermaLink="true">https://forum.qt.io/post/484857</guid><dc:creator><![CDATA[DavidM29]]></dc:creator><pubDate>Tue, 02 Oct 2018 14:50:07 GMT</pubDate></item><item><title><![CDATA[Reply to Algorithm to find all possible combinations on Tue, 02 Oct 2018 13:54:31 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/davidm29">@<bdi>DavidM29</bdi></a>,</p>
<p dir="auto">A very cheap (and probably slow, but that should not matter for such small lists) solution would be to have some nested for loops.</p>
<p dir="auto">For the first, second and forth list you take one element per iteration.</p>
<p dir="auto">Unfortuantely, for the third list you will have to take all possible combinations, which <em>could</em> be done by creating a temporary list C' (-; E; F; E, F) first. (don't know if you need F, E also?)</p>
<p dir="auto">Regards</p>
]]></description><link>https://forum.qt.io/post/484838</link><guid isPermaLink="true">https://forum.qt.io/post/484838</guid><dc:creator><![CDATA[aha_1980]]></dc:creator><pubDate>Tue, 02 Oct 2018 13:54:31 GMT</pubDate></item></channel></rss>