<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: My solution to the counting sets challenge</title>
	<atom:link href="http://www.algorithm.co.il/blogs/programming/python/my-solution-to-the-counting-sets-challenge/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.algorithm.co.il/blogs/challenges/my-solution-to-the-counting-sets-challenge/</link>
	<description>Algorithms, for the heck of it</description>
	<lastBuildDate>Tue, 21 Jun 2011 21:07:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: lorg</title>
		<link>http://www.algorithm.co.il/blogs/challenges/my-solution-to-the-counting-sets-challenge/#comment-226</link>
		<dc:creator>lorg</dc:creator>
		<pubDate>Mon, 07 Sep 2009 22:50:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/?p=325#comment-226</guid>
		<description>rouli:
Regarding every two sets&#039; union being equal to the union of all sets - well, fortunately that doesn&#039;t happen in my input.
I forgot to mention that before I implemented the algorithm I did various &quot;dry tests&quot;, of estimating the the number of containment tests. In the general/worst case (without &#039;max_appear&#039;), where the input set is also contained in many set, it really isn&#039;t good. It&#039;s very easy to kill this algorithm, but for &#039;sane&#039; input it performs well enough.

As I said - there are many other drawbacks. For example, the set group may be ordered in such a way that the tree built from it will be very inefficient later on. My (theoretical) cheap shot at this was to randomize the order. I thought of some more drawbacks, but enough for now. Especially since it works :)</description>
		<content:encoded><![CDATA[<p>rouli:<br />
Regarding every two sets&#8217; union being equal to the union of all sets &#8211; well, fortunately that doesn&#8217;t happen in my input.<br />
I forgot to mention that before I implemented the algorithm I did various &#8220;dry tests&#8221;, of estimating the the number of containment tests. In the general/worst case (without &#8216;max_appear&#8217;), where the input set is also contained in many set, it really isn&#8217;t good. It&#8217;s very easy to kill this algorithm, but for &#8216;sane&#8217; input it performs well enough.</p>
<p>As I said &#8211; there are many other drawbacks. For example, the set group may be ordered in such a way that the tree built from it will be very inefficient later on. My (theoretical) cheap shot at this was to randomize the order. I thought of some more drawbacks, but enough for now. Especially since it works :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lorg</title>
		<link>http://www.algorithm.co.il/blogs/challenges/my-solution-to-the-counting-sets-challenge/#comment-225</link>
		<dc:creator>lorg</dc:creator>
		<pubDate>Mon, 07 Sep 2009 22:42:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/?p=325#comment-225</guid>
		<description>Rani:
It&#039;s good to see the proper name for the &quot;soldier-testing&quot; algorithm, thanks!
I didn&#039;t understand though if you can adapt/find a better solution for the challenge. I&#039;ll be happy to hear what you think - especially if it reduces the running time of my (very real) program :)</description>
		<content:encoded><![CDATA[<p>Rani:<br />
It&#8217;s good to see the proper name for the &#8220;soldier-testing&#8221; algorithm, thanks!<br />
I didn&#8217;t understand though if you can adapt/find a better solution for the challenge. I&#8217;ll be happy to hear what you think &#8211; especially if it reduces the running time of my (very real) program :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lorg</title>
		<link>http://www.algorithm.co.il/blogs/challenges/my-solution-to-the-counting-sets-challenge/#comment-224</link>
		<dc:creator>lorg</dc:creator>
		<pubDate>Mon, 07 Sep 2009 22:38:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/?p=325#comment-224</guid>
		<description>rouli:
That was one of the reasons I didn&#039;t implement this solution right away. If the given set is contained in all the sets, you&#039;ll do 2*n-1 checks to discover this. Before I thought of &#039;max_appear&#039;, I thought of other checks you can do before you run it, and then maybe run a different algorithm, maybe even the naive one.

I also tried running eric and Shenberg&#039;s solution only for input sets of cardinality 1 and 2 (and for the rest run my solution), but that one intersection was enough to kill it. There&#039;s still a possibility that there are a few implementation kinks I put there that can fix it, but I doubt it.</description>
		<content:encoded><![CDATA[<p>rouli:<br />
That was one of the reasons I didn&#8217;t implement this solution right away. If the given set is contained in all the sets, you&#8217;ll do 2*n-1 checks to discover this. Before I thought of &#8216;max_appear&#8217;, I thought of other checks you can do before you run it, and then maybe run a different algorithm, maybe even the naive one.</p>
<p>I also tried running eric and Shenberg&#8217;s solution only for input sets of cardinality 1 and 2 (and for the rest run my solution), but that one intersection was enough to kill it. There&#8217;s still a possibility that there are a few implementation kinks I put there that can fix it, but I doubt it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rouli</title>
		<link>http://www.algorithm.co.il/blogs/challenges/my-solution-to-the-counting-sets-challenge/#comment-223</link>
		<dc:creator>rouli</dc:creator>
		<pubDate>Mon, 07 Sep 2009 20:17:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/?p=325#comment-223</guid>
		<description>Actually, I pondered about this method, and dismissed it once I&#039;ve thought about the scenario where the union of every two sets in the original list of sets equals the union of all the sets in the original list.
In that case, you&#039;ll have to go all the way down, doing more comparisons than in the naive algorithm.
(Obviously it&#039;s solved by introducing max_appear)</description>
		<content:encoded><![CDATA[<p>Actually, I pondered about this method, and dismissed it once I&#8217;ve thought about the scenario where the union of every two sets in the original list of sets equals the union of all the sets in the original list.<br />
In that case, you&#8217;ll have to go all the way down, doing more comparisons than in the naive algorithm.<br />
(Obviously it&#8217;s solved by introducing max_appear)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rani</title>
		<link>http://www.algorithm.co.il/blogs/challenges/my-solution-to-the-counting-sets-challenge/#comment-222</link>
		<dc:creator>Rani</dc:creator>
		<pubDate>Mon, 07 Sep 2009 19:28:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.algorithm.co.il/blogs/?p=325#comment-222</guid>
		<description>The problem you&#039;re referring to is called Combinatorial Group Testing, and has efficient* solutions even when:
(i) more than one soldier is sick (say, at most k out of n), and
(ii) you want to decide in advance which samples get sent to the lab, instead of waiting log(n) roundtrips (this property is called non-adaptiveness).

For the case of k=1 you can pick the unions to check as follows:
union number i has all sets whose index j satisfies (j&gt;&gt;i)&amp;1==1.

* Thats O( k^2 log(n/k) ).</description>
		<content:encoded><![CDATA[<p>The problem you&#8217;re referring to is called Combinatorial Group Testing, and has efficient* solutions even when:<br />
(i) more than one soldier is sick (say, at most k out of n), and<br />
(ii) you want to decide in advance which samples get sent to the lab, instead of waiting log(n) roundtrips (this property is called non-adaptiveness).</p>
<p>For the case of k=1 you can pick the unions to check as follows:<br />
union number i has all sets whose index j satisfies (j&gt;&gt;i)&amp;1==1.</p>
<p>* Thats O( k^2 log(n/k) ).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

