<?xml version='1.0' encoding='utf-8' ?>
<!--  If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/  -->
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:media='http://search.yahoo.com/mrss/'>
<channel>
  <title>Rack | rrenaud | Rob | Robert Renaud&apos;s LiveJournal</title>
  <link>http://ru-linux-geek.livejournal.com/</link>
  <description>Rack | rrenaud | Rob | Robert Renaud&apos;s LiveJournal - LiveJournal.com</description>
  <lastBuildDate>Thu, 09 Apr 2009 19:44:12 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <lj:journal>ru_linux_geek</lj:journal>
  <lj:journalid>2864795</lj:journalid>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>http://l-userpic.livejournal.com/21476248/2864795</url>
    <title>Rack | rrenaud | Rob | Robert Renaud&apos;s LiveJournal</title>
    <link>http://ru-linux-geek.livejournal.com/</link>
    <width>40</width>
    <height>40</height>
  </image>

<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/40096.html</guid>
  <pubDate>Thu, 09 Apr 2009 19:44:12 GMT</pubDate>
  <title>Worst TED talk ever?</title>
  <link>http://ru-linux-geek.livejournal.com/40096.html</link>
  <description>Does the graph of 5 people, with 5 choose 2 = 10 connections bug you when he says 120?  What about when he shows 10 people, with 10 choose 2 = 45 connections, and then says 10 factorial is approximately 3.6 million?  Does it irk you that he never actually describes what an &quot;interaction&quot; is?  Skip to 6 minutes and 30 seconds if you are lazy or bored.&lt;br /&gt;&lt;br /&gt;&lt;lj-embed id=&quot;3&quot; /&gt;</description>
  <comments>http://ru-linux-geek.livejournal.com/40096.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/39800.html</guid>
  <pubDate>Mon, 02 Mar 2009 19:15:06 GMT</pubDate>
  <title>Funny and insulting correlation</title>
  <link>http://ru-linux-geek.livejournal.com/39800.html</link>
  <description>Someone had the idea to look at people&apos;s favorite books and bands and correlate that with the average SAT score of the university that the person attended.  The details are &lt;a href=&quot;http://blogs.wsj.com/digits/2009/02/27/books-and-music-that-make-you-dumb/&quot;&gt;here&lt;/a&gt;.</description>
  <comments>http://ru-linux-geek.livejournal.com/39800.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/39439.html</guid>
  <pubDate>Wed, 10 Dec 2008 23:14:17 GMT</pubDate>
  <title>Larry started a board gaming blog</title>
  <link>http://ru-linux-geek.livejournal.com/39439.html</link>
  <description>The name, &lt;a href=&quot;http://bgholic.com&quot;&gt;Board Game Holic&lt;/a&gt; is probably quite fitting for me ;).&lt;br /&gt;&lt;br /&gt;My first article written reasons about winning the &lt;a href=&quot;http://www.bgholic.com/story/race-galaxy-all-abilities-coder-challenge-6&quot;&gt;all abilities goal in a probabilistic manner&lt;/a&gt;.  And who doesn&apos;t like a combination of probability, Race for the Galaxy, and dynamic programming?</description>
  <comments>http://ru-linux-geek.livejournal.com/39439.html</comments>
  <category>probability</category>
  <category>dynamic programming</category>
  <category>race</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/39318.html</guid>
  <pubDate>Mon, 08 Dec 2008 18:46:22 GMT</pubDate>
  <title>A little bit of bragging</title>
  <link>http://ru-linux-geek.livejournal.com/39318.html</link>
  <description>The picture is not nearly as bad as I expected.  But maybe that&apos;s just because I am used to looking at my currently insanely unkempt hair.&lt;br /&gt;&lt;br /&gt;The report for the &lt;a href=&quot;http://boardgamers.org/yearbook/rfgpge.htm&quot;&gt;2008 Race for the Galaxy World Boardgaming Championship&lt;/a&gt; has been posted.</description>
  <comments>http://ru-linux-geek.livejournal.com/39318.html</comments>
  <category>rftg</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/39073.html</guid>
  <pubDate>Thu, 23 Oct 2008 03:51:37 GMT</pubDate>
  <title>A nifty little election time dynamic program</title>
  <link>http://ru-linux-geek.livejournal.com/39073.html</link>
  <description>Take a look at &lt;a href=&quot;http://www.xkcd.com/intrade&quot;&gt;xkcd&apos;s election predictor&lt;/a&gt;.  It scrapes a bunch of election outcome probabilities per state from intrade and uses them to provide a prediction for the overall election.  It does so by using a Monte Carlo simulation, given the probabilities, it runs a mock election assuming each state outcome is independent a whole bunch of times with those probabilities and see what happens.  In his code, he runs the simulation 100,000 times.  On my laptop, this takes about 4 seconds and yields only an approximation with error of about .001.  Aww, poor physicist, if only Randall was a computer scientist, maybe he&apos;d see how to compute it exactly and much more quickly.&lt;br /&gt;&lt;br /&gt;So, how can we compute this efficiently?  The key to my program running quickly is that total number of electoral votes (538) is much smaller than the total number of possible election outcomes (2^50).  &lt;br /&gt;&lt;br /&gt;Imagine we have a partially computed an election in which &lt;i&gt;k&lt;/i&gt; states have already voted, and that &lt;i&gt;p&lt;sub&gt;k,i&lt;/sub&gt;&lt;/i&gt; is the probability that the democrats have won exactly &lt;i&gt;i&lt;/i&gt; electoral votes after the first &lt;i&gt;k&lt;/i&gt; elections have run. Furthermore, let &lt;i&gt;v&lt;sub&gt;k&lt;/sub&gt;&lt;/i&gt; be the number of electoral votes for state &lt;i&gt;k&lt;/i&gt; and &lt;i&gt;e&lt;sub&gt;k&lt;/sub&gt;&lt;/i&gt; be the probability state that state &lt;i&gt;k&lt;/i&gt; elects a democrat.&lt;br /&gt;&lt;br /&gt;How can we compute &lt;i&gt;p&lt;sub&gt;k,i&lt;/sub&gt;&lt;/i&gt;?  Well, this simple little recurrence will do it.&lt;br /&gt;&lt;i&gt;p&lt;sub&gt;k,i&lt;/sub&gt; = e&lt;sub&gt;k&lt;/sub&gt; * p&lt;sub&gt;k-1,i - v&lt;sub&gt;k&lt;/sub&gt;&lt;/sub&gt; + (1 - e&lt;sub&gt;k&lt;/sub&gt;) * p&lt;sub&gt;k-1, i&lt;/sub&gt;&lt;/i&gt;.  Basically, with probability &lt;i&gt;e&lt;sub&gt;k&lt;/sub&gt;&lt;/i&gt; the state votes democrat and has &lt;i&gt;i - v&lt;sub&gt;k&lt;/sub&gt;&lt;/i&gt; votes left, otherwise, with probability &lt;i&gt;1 - e&lt;sub&gt;k&lt;/sub&gt;&lt;/i&gt; it votes republican (assuming two party system), and the democrat still has &lt;i&gt;i&lt;/i&gt; votes left.  For this problem, we only need about 539 * 51 table entries (we could even do something clever and push the needed space down to 539 entries, but I&apos;ll leave that as an exercise for the reader).&lt;br /&gt;&lt;br /&gt;After I implemented this, the computation runs much more quickly than one second and provides an exact answer.&lt;br /&gt;&lt;br /&gt;Looking at the code a bit more, I found a (slightly refactored) snippet of code like this.  I assume the code is supposed to output the outcomes in order.  Take a look at the comment, is it simpler than sorting?  Is it even correct?  I challenge both accounts.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;color:#000000;background:#ffffff;&quot;&gt;&lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;def&lt;/span&gt; render_outcome&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;pdem&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; prep&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; ptie&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;:&lt;/span&gt;
    dstring&lt;span style=&quot;color:#808030; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;Obama:  &amp;lt;span style=\&quot;color: #0000FF\&quot;&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;round&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;pdem&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color:#008c00; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;&amp;lt;/span&amp;gt;&quot;&lt;/span&gt;
    rstring&lt;span style=&quot;color:#808030; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;McCain: &amp;lt;span style=\&quot;color: #FF0000\&quot;&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;round&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;prep&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:#008c00; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;&amp;lt;/span&amp;gt;&quot;&lt;/span&gt;
    tstring&lt;span style=&quot;color:#808030; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;Tie: &amp;lt;span style=\&quot;color: #888888\&quot;&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;round&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;ptie&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:#008c00; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;&amp;lt;/span&amp;gt;&quot;&lt;/span&gt;

    &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;if&lt;/span&gt; pdem&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;prep &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;and&lt;/span&gt; prep&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;ptie&lt;span style=&quot;color:#808030; &quot;&gt;:&lt;/span&gt;
        &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;return&lt;/span&gt; dstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;rstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;tstring
    &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;if&lt;/span&gt; prep&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;pdem &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;and&lt;/span&gt; pdem&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;ptie&lt;span style=&quot;color:#808030; &quot;&gt;:&lt;/span&gt;
        &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;return&lt;/span&gt; rstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;dstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;tstring
    &lt;b&gt;&lt;span style=&quot;color:#000000; &quot;&gt;#just in case ... (easier to do this than a sort)&lt;/span&gt;&lt;/b&gt;
    &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;if&lt;/span&gt; pdem&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;ptie &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;and&lt;/span&gt; ptie&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;prep&lt;span style=&quot;color:#808030; &quot;&gt;:&lt;/span&gt;
        &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;return&lt;/span&gt; dstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;tstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;rstring
    &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;if&lt;/span&gt; prep&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;ptie &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;and&lt;/span&gt; ptie&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;pdem&lt;span style=&quot;color:#808030; &quot;&gt;:&lt;/span&gt;
        &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;return&lt;/span&gt; rstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;tstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;dstring
    &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;if&lt;/span&gt; ptie&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;pdem &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;and&lt;/span&gt; pdem&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;prep&lt;span style=&quot;color:#808030; &quot;&gt;:&lt;/span&gt;
        &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;return&lt;/span&gt; tstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;dstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;rstring
    &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;if&lt;/span&gt; ptie&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;prep &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;and&lt;/span&gt; prep&lt;span style=&quot;color:#808030; &quot;&gt;&amp;gt;&lt;/span&gt;pdem&lt;span style=&quot;color:#808030; &quot;&gt;:&lt;/span&gt;
        &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;return&lt;/span&gt; tstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;rstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;dstring
    &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;return&lt;/span&gt; tstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;rstring&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;dstring&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is my alternative implementation.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;color:#000000;background:#ffffff;&quot;&gt;&lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;def&lt;/span&gt; render_outcome2&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;pdem&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; prep&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; ptie&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;:&lt;/span&gt;
    dstring&lt;span style=&quot;color:#808030; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;obama:  &amp;lt;span style=\&quot;color: #0000ff\&quot;&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;round&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;pdem&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color:#008c00; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;&amp;lt;/span&amp;gt;&quot;&lt;/span&gt;
    rstring&lt;span style=&quot;color:#808030; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;mccain: &amp;lt;span style=\&quot;color: #ff0000\&quot;&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;round&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;prep&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:#008c00; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;&amp;lt;/span&amp;gt;&quot;&lt;/span&gt;
    tstring&lt;span style=&quot;color:#808030; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;tie: &amp;lt;span style=\&quot;color: #888888\&quot;&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#e34adc; &quot;&gt;round&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;ptie&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:#008c00; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#0000e6; &quot;&gt;&quot;&amp;lt;/span&amp;gt;&quot;&lt;/span&gt;
    l &lt;span style=&quot;color:#808030; &quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color:#808030; &quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;pdem&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; dstring&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;prep&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; rstring&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;ptie&lt;span style=&quot;color:#808030; &quot;&gt;,&lt;/span&gt; tstring&lt;span style=&quot;color:#808030; &quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;]&lt;/span&gt;
    &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color:#0000e6; &quot;&gt;&apos;\n&apos;&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color:#808030; &quot;&gt;(&lt;/span&gt;pair&lt;span style=&quot;color:#808030; &quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color:#008c00; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#808030; &quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;for&lt;/span&gt; pair &lt;span style=&quot;color:#800000; font-weight:bold; &quot;&gt;in&lt;/span&gt; sorted(l, reverse=True))
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Mine definitely seems simpler.  It relies on the natural sorting order of python tuples to get the messages sorted in the right order.&lt;br /&gt;&lt;br /&gt;Is his implementation correct?  Well.. notice all of those &amp;lt; operators (not &amp;lt;=).  What happens with ties?&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;gt;&amp;gt;&amp;gt; print states.render_outcome(.4, .3, .3)
Tie: &lt;span style=&quot;color: #888888&quot;&gt;0.3&lt;/span&gt;
McCain: &lt;span style=&quot;color: #FF0000&quot;&gt;0.3&lt;/span&gt;
Obama:  &lt;span style=&quot;color: #0000FF&quot;&gt;0.4&lt;/span&gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Uh oh..&lt;br /&gt;&lt;br /&gt;In all fairness, quoting the page, Randall says &quot;&lt;i&gt;I made this tool to help me understand the race, especially on election night&lt;/i&gt;.&quot;  I am sure he just wanted to get things done, and not have some nerd nitpick at all of the code.  The Monte Carlo simulation is a bit easier to code than the dynamic program I posted and it gets things done. His code basically works.  I don&apos;t think he actually sucks at programming, I just wanted to put some blood on the pages for reddit.  Furthermore, I was thinking about using this problem as an interview question, but after trying it on a few of my coworkers (who all have at least a BS in computer science from a nice university), I think it&apos;s a bit too hard.</description>
  <comments>http://ru-linux-geek.livejournal.com/39073.html</comments>
  <category>election</category>
  <category>algorithms</category>
  <category>xkcd</category>
  <category>dynamic programming</category>
  <lj:security>public</lj:security>
  <lj:reply-count>12</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/38672.html</guid>
  <pubDate>Wed, 22 Oct 2008 02:12:21 GMT</pubDate>
  <title>TrainLogic, you suck</title>
  <link>http://ru-linux-geek.livejournal.com/38672.html</link>
  <description>I was in New Brunswick and I wanted to know when the next train was this Sunday.  As anyone with a blackberry knows, the New Jersey transit website sucks on the blackberry browser.  So I install this blackberry app from TrainLogic that seems useful. &lt;br /&gt;&lt;br /&gt;Wow, what a giant waste of time.  Ugh.  Installing it involves copying a serial number from the application onto an online form and solving a case sensitive captcha (this is miserable on the auto text completing blackberry).  Don&apos;t worry, if you screw up a single input, your input will be erased and you will need to start over, painfully retyping that 10 character serial and inputting another the 5 character random captca.  If you unlock the app this far it will finally tell you that it is &quot;randomly changing the train times.&quot;  You can go online again and give them $7 for 6 month access to a schedule.  No thanks.  I feel like I should be getting paid for dealing with so much bullshit.  It took me about 15 minutes to get here.  Miserable!</description>
  <comments>http://ru-linux-geek.livejournal.com/38672.html</comments>
  <category>trainlogic</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/38616.html</guid>
  <pubDate>Thu, 21 Aug 2008 03:47:18 GMT</pubDate>
  <title>Regina Spektor is amazing</title>
  <link>http://ru-linux-geek.livejournal.com/38616.html</link>
  <description>&lt;lj-embed id=&quot;2&quot; /&gt;</description>
  <comments>http://ru-linux-geek.livejournal.com/38616.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/38361.html</guid>
  <pubDate>Tue, 12 Aug 2008 16:02:36 GMT</pubDate>
  <title>[Gamers-ny] Rob &quot;Crackhead&quot; Renaud Wins RftG World Championship, Positively Reinforces Addiction</title>
  <link>http://ru-linux-geek.livejournal.com/38361.html</link>
  <description>&lt;blockquote&gt;&lt;br /&gt;Rob&apos;s reign as world-champion was, however, short-lived.  Peter Schmitt, yesterday, with his masterful employ of the dreaded Galatic Federation / Trade League combo, served Rob a slice of humble pie.  The price for this delicious mocel of baked good:  Rob&apos;s RftG World Championship Belt.  Down, but not out, Rob has pledged to remain addicted to RftG to the exclusion of his hair&apos;s kemptness.&lt;br /&gt;&lt;br /&gt;Games Night.  6 PM.  5BB.  RftG Intercontinental Championship up for grabs.  No hitting other players with metal chairs please.&lt;br /&gt;&lt;/blockquote&gt; &lt;br /&gt;&lt;br /&gt;- Ross Fairgrieve&lt;br /&gt;&lt;br /&gt;Of course, it wasn&apos;t a title match.  For that, only next year&apos;s &lt;a href=&quot;http://boardgamers.org/&quot;&gt;World Boardgaming Championship&lt;/a&gt; will suffice.</description>
  <comments>http://ru-linux-geek.livejournal.com/38361.html</comments>
  <category>rftg</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/38047.html</guid>
  <pubDate>Tue, 24 Jun 2008 04:00:08 GMT</pubDate>
  <title>A favorable ratio</title>
  <link>http://ru-linux-geek.livejournal.com/38047.html</link>
  <description>I am not looking, and even if I was, perhaps a Kimya Dawson/Ani DiFranco concert isn&apos;t the best place to find straight women, but this is impressive.  These are people who have confirmed they are going to the concert on iLike.&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src=&quot;http://ruslug.rutgers.edu/~rrenaud/ani_kimya_favorable_ratio.jpg&quot;&gt;&lt;/center&gt;</description>
  <comments>http://ru-linux-geek.livejournal.com/38047.html</comments>
  <category>ani difranco</category>
  <category>kimya dawson</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/37651.html</guid>
  <pubDate>Fri, 18 Apr 2008 05:28:59 GMT</pubDate>
  <title>Amazon MP3 download service</title>
  <link>http://ru-linux-geek.livejournal.com/37651.html</link>
  <description>Has anyone tried it?  I just bought &lt;a href=&quot;http://www.myspace.com/jaymay&quot;&gt;Jaymay&apos;s&lt;/a&gt; Autumn Fallin&apos;, mostly on the strength of the single &quot;Gray or Blue.&quot;  The Amazon download service is kind of weird, they insist you download a (proprietary, but at least one exists for Linux) client to download the songs, and then they won&apos;t let you redownload songs you&apos;ve purchased.  But at least you get unencumbered mp3s.  Oggs would have been nice, but I guess you can&apos;t ask for too much.</description>
  <comments>http://ru-linux-geek.livejournal.com/37651.html</comments>
  <category>amazon</category>
  <category>jaymay</category>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/37555.html</guid>
  <pubDate>Fri, 21 Mar 2008 07:09:26 GMT</pubDate>
  <title>Travelling salesman, xkcd, and a month old reddit post.</title>
  <link>http://ru-linux-geek.livejournal.com/37555.html</link>
  <description>From a &lt;a href=&quot;http://reddit.com/info/694m3/comments/c037rlt&quot;&gt;reddit post&lt;/a&gt; I made a month ago.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;There are n! paths in a graph of size n. I can find the optimal TSP solution in O(n^2 2^n) time. Therefore, it is possible to do better than examine every path to find a TSP solution.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.algorithmist.com/index.php/Traveling_Salesperson_Problem&quot;&gt;http://www.algorithmist.com/index.php/Traveling_Salesperson_Problem&lt;/a&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And today&apos;s xkcd comic.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://xkcd.com/399/&quot;&gt;&lt;img src=&quot;http://imgs.xkcd.com/comics/travelling_salesman_problem.png&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Suspicious?&lt;br /&gt;&lt;br /&gt;I just wish I had a modicum of artistic ability, I swear I&apos;ve got about five ideas for good xkcd style comics.</description>
  <comments>http://ru-linux-geek.livejournal.com/37555.html</comments>
  <category>reddit</category>
  <category>algorithms</category>
  <category>xkcd</category>
  <category>tsp</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/37237.html</guid>
  <pubDate>Sat, 08 Mar 2008 05:28:16 GMT</pubDate>
  <title>Hidden public information in board games, you suck</title>
  <link>http://ru-linux-geek.livejournal.com/37237.html</link>
  <description>Chess and go are two great games, they have no hidden information.  Ingenious is a great game with no hidden public information.  Simon is a terrible game.  Board game designers, every time you make your games include hidden public information, you make your games less like chess and more like simon.  This is clearly a step in the wrong direction.  Why, oh why do you do this?  Remembering things is not fun.  Making informed decisions between two options is.  Stop making memory necessary for informed decisions.  Please!  El Grande, I am looking at you.&lt;br /&gt;&lt;br /&gt;Will anyone take the position that hidden public information is actually a good thing?</description>
  <comments>http://ru-linux-geek.livejournal.com/37237.html</comments>
  <category>hidden public information</category>
  <category>chess</category>
  <category>board game design</category>
  <category>el grande</category>
  <category>board games</category>
  <category>ingenious</category>
  <lj:security>public</lj:security>
  <lj:reply-count>4</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/37002.html</guid>
  <pubDate>Tue, 29 Jan 2008 05:04:43 GMT</pubDate>
  <title>February, month of the 33rd floor walkup?</title>
  <link>http://ru-linux-geek.livejournal.com/37002.html</link>
  <description>I am debating whether I should try going the month of February without using an elevator&lt;sup&gt;*&lt;/sup&gt;.  I figure it would be a good source of mandatory exercise, and it would create some fun stories.  Much like walking 4.5 miles (and 4.5 miles back) from Manhattan to Brooklyn over the Manhattan Bridge just for dinner is both good story and good exercise.&lt;br /&gt;&lt;br /&gt;* I will use the elevator if I am with other people, or carrying skis.  Newport has this stupid policy that the entrance to the stairs is locked going in, so I&apos;ll have to wait for the elevator and get out on the second floor anyway.  This is a big disincentive to taking the stairs.</description>
  <comments>http://ru-linux-geek.livejournal.com/37002.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/36774.html</guid>
  <pubDate>Mon, 21 Jan 2008 06:31:22 GMT</pubDate>
  <title>The greatest song ever</title>
  <link>http://ru-linux-geek.livejournal.com/36774.html</link>
  <description>So my sister complained that I haven&apos;t posted in two weeks.  This is what you get.&lt;br /&gt;&lt;br /&gt;The Chelsea Hotel Oral Sex Song by Jeffrey Lewis.  The youtube link has poor audio and will force you to sit through annoying banter for a minute and a half, but you&apos;ll see his &quot;low budget video.&quot;  &lt;a href=&quot;http://www.mediafire.com/?4xzx3ymmaim&quot;&gt;Here is a link&lt;/a&gt; to recording the song, which is much better quality.&lt;br /&gt;&lt;br /&gt;&lt;lj-embed id=&quot;1&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Okay, so this isn&apos;t the greatest song ever.  Hell, it&apos;s probably terrible.  But I am going to see him live at the Mercury Lounge anyway.</description>
  <comments>http://ru-linux-geek.livejournal.com/36774.html</comments>
  <category>jeffrey lewis</category>
  <category>chelsea hotel</category>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/36522.html</guid>
  <pubDate>Sun, 06 Jan 2008 08:04:49 GMT</pubDate>
  <title>The right way to understand repeated squaring</title>
  <link>http://ru-linux-geek.livejournal.com/36522.html</link>
  <description>So, I wish I could say I was over &lt;a href=&quot;http://ru-linux-geek.livejournal.com/35777.html&quot;&gt;this&lt;/a&gt;, but I am still having bouts of sadness and self-induced frustration.  But at least I am having dreams about algorithms, which you know, kind of rocks.  Even if my ability to reason in my dreams is laughably bad.&lt;br /&gt;&lt;br /&gt;In my most recent dream, I was arguing in a classroom about the &quot;right&quot; way to understand repeated squaring.  This was the argument that I wanted to make, but failed to express clearly in my dream.&lt;br /&gt;&lt;br /&gt;I wrote most of the algorithmist article on &lt;a href=&quot;http://www.algorithmist.com/index.php/Repeated_Squaring&quot;&gt;repeated squaring&lt;/a&gt; awhile ago.  The way I used to understand repeated squaring is explained by example in the write up.  It basically comes down to writing the exponent in binary, accumulating the appropriate terms for each position the binary expansion of the exponent by repeatedly squaring the last position, and then finally multiplying out all the terms where there is a bit set.  This works and provides some insight into how the algorithm works.&lt;br /&gt;&lt;br /&gt;However, this is the wrong way to understand the algorithm.  &lt;br /&gt;&lt;br /&gt;The right way is expressed beautifully by this equation.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://ruslug.rutgers.edu/~rrenaud/repeated_squaring.png&quot; alt=&quot;x^y = (x^{y~{\rm div}~2})^2 \cdot x^{y\bmod 2}&quot;&gt;&lt;br /&gt;&lt;br /&gt;What does the first part equation say?  &lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://ruslug.rutgers.edu/~rrenaud/divide_repeated_squaring.png&quot; alt=&quot;(x^{y~{\rm div}~2})&quot;&gt;&lt;br /&gt;&lt;br /&gt;Well, it says divide the problem into problem of approximately half the size.  This smaller problem can be solved recursively.  The division here is the C-style truncating integer division.  The square then uses the information from the subproblem to compute the larger problem.  The last part of the equation,&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://ruslug.rutgers.edu/~rrenaud/conquer_repeated_squaring.png&quot; alt=&quot;x^{y\bmod 2}&quot;&gt;&lt;br /&gt;&lt;br /&gt;Simply handles the case that the division truncated exponent and we would have otherwise lost a multiple of the base.&lt;br /&gt;&lt;br /&gt;On a technical note, from either view of the algorithm, it&apos;s pretty easy to &lt;br /&gt;see that the number of total number of multiplications required is no worse than 2lg(y).&lt;br /&gt;&lt;br /&gt;What is the key difference between the two views of the algorithm?  The first is iterative, understanding the computation involves understanding every minute detail of the accumulation loop and it&apos;s relation to the binary expansion of the exponent.  The second view uses recursion to leverage abstraction.  Instead of understanding the whole process, you simply need to understand how to make the problem smaller and how to put the pieces together on a high level.  There is really a parallel here between iterative and functional programming.  Ironically, I am coming out on the functional programming side.&lt;br /&gt;&lt;br /&gt;So why is the second view better than the first view?  The higher level, more abstracted view is much easier to generalize.  Instead of computing x^y efficiently, let&apos;s consider the problem of computing a^b * x^y.  Let n = max(b, y).  This can be done straight-forwardly with two applications of the repeated squaring algorithm in 4lg(n) + some constant k multiplications.  However, a modified algorithm can solve the problem with 2lg(n) + k multiplications.  &lt;font size=&quot;=1&quot;&gt;Credit for this problem goes to my sister&apos;s &quot;Reasoning about Computation&quot; class.  It&apos;s the best class I never took.  Sigh, sometimes I wish I did CS at Princeton.&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;How do you do it?&lt;br /&gt;&lt;br /&gt;Here is some empty space in case you want to try to figure it out yourself.  Hint:  Try to use divide and conquer.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Well, to compute a^b * x^y, first compute a^(b/2) * x^(y/2) recursively.  Now square it.  There are just 4 cases depending on the truncation of b and y.  If b and y were both truncated, we need an additional multiple of a * x, which can be precomputed ahead of time for cost of a single multiplication at this recursive step.  Otherwise, if only b was truncated, we just need an additional multiple of a.  Likewise, if only y was truncated, we need an additional multiple of x.  Otherwise, no additional multiplications are needed.  Simple, elegant, clever.  Gotta love it.&lt;br /&gt;&lt;br /&gt;Exercise for the readers:  Further generalize the algorithm.  Show how to compute a_1 ^ b_1 * a_2 ^ b_2 * ... a_j ^ b_j in 2 lg(n) + 2^j + k multiplications, where n = max(b_1, b_2, ... b_j) and k is a constant.&lt;br /&gt;&lt;br /&gt;I spent quite a bit of time trying to solve this problem, mostly stuck because I was trying to use the first understanding of the problem and I couldn&apos;t see how to leverage the binary expansion of both exponents simultaneously.</description>
  <comments>http://ru-linux-geek.livejournal.com/36522.html</comments>
  <category>repeated squaring</category>
  <category>algorithms</category>
  <category>dreams</category>
  <lj:security>public</lj:security>
  <lj:reply-count>5</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/36160.html</guid>
  <pubDate>Wed, 02 Jan 2008 01:00:30 GMT</pubDate>
  <title>Something is wrong with New York</title>
  <link>http://ru-linux-geek.livejournal.com/36160.html</link>
  <description>So I log into facebook and see this.  There is something wrong with New York when Coldplay is as popular as entire music genres.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://ruslug.rutgers.edu/~rrenaud/something_wrong_with_ny.png&quot;&gt;</description>
  <comments>http://ru-linux-geek.livejournal.com/36160.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/36089.html</guid>
  <pubDate>Mon, 31 Dec 2007 08:55:16 GMT</pubDate>
  <title>What to do when you can&apos;t sleep?</title>
  <link>http://ru-linux-geek.livejournal.com/36089.html</link>
  <description>Why not attempt to &lt;a href=&quot;https://www.blogger.com/comment.g?blogID=2811876938195306723&amp;amp;postID=1865119672488336896&quot;&gt;write proofs about computable numbers&lt;/a&gt;?  I guess I&apos;ll see if I really understood my &lt;a href=&quot;http://ru-linux-geek.livejournal.com/2175.html&quot;&gt;formal languages class&lt;/a&gt;.  But anything labeled a paradox is probably pretty tricky, so I am not too confident that I right.&lt;br /&gt;&lt;br /&gt;Edit:  Apparently, I am good enough to write correct proofs without sleep ;).</description>
  <comments>http://ru-linux-geek.livejournal.com/36089.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/35777.html</guid>
  <pubDate>Mon, 31 Dec 2007 03:11:36 GMT</pubDate>
  <title>&quot;Ask me a question&quot;</title>
  <link>http://ru-linux-geek.livejournal.com/35777.html</link>
  <description>... :(</description>
  <comments>http://ru-linux-geek.livejournal.com/35777.html</comments>
  <lj:mood>sad</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/35523.html</guid>
  <pubDate>Wed, 26 Dec 2007 08:10:56 GMT</pubDate>
  <title>A proof I will never forget: An algorithms story</title>
  <link>http://ru-linux-geek.livejournal.com/35523.html</link>
  <description>Many moons ago, I was taking computer science 344, Design and Analysis of Computer Algorithms at Rutgers.  The simplicity and beauty of the subject matter was unmatched by anything else I&apos;d studied except Newtonian mechanics, and algorithms, being based on mathematical formalisms rather than the messy physical universe, actually have the nice property of not being wrong.&lt;br /&gt;&lt;br /&gt;We were studying median finding and sorting.  The professor asked if we could come up with an algorithm to determine if an array of n elements had no duplicates using only comparisons in better than O(n log n) time.  This is a classic problem in Computer Science, dubbed &lt;a href=&quot;http://en.wikipedia.org/wiki/Element_uniqueness_problem&quot;&gt;element uniqueness&lt;/a&gt;.  Surely, as a professor of theoretical computer science, he knew this was impossible.&lt;br /&gt;&lt;br /&gt;I, however, did not know it was impossible.  I had even come up with an algorithm that I thought worked.  I sent an email to the professor containing my algorithm.  I omit the email from the body of this post to save myself embarrassment, but needless to say it was clearly wrong in retrospect. He told me to present the algorithm in class, knowing I was attempting the provably impossible.&lt;br /&gt;&lt;br /&gt;So what happens?  I get up in the front of class and present my bogus algorithm.  The professor asks the students if anyone sees anything wrong with the algorithm and then someone comes and points out how it doesn&apos;t actually work.  I make an ass out of myself.  &lt;br /&gt;&lt;br /&gt;Fast forward to my latest semester at NYU, where I decide to take Fundamental Algorithms.  This is basically 344 all over.  Although letting my dating life influence my class selection is probably not something I&apos;ll do again (I totally wussed out of taking an advanced algorithms class, which would have probably been challenging and worthwhile but taken enough time to making trying to date n girls simultaneously impossible), it wasn&apos;t a total waste of time.  After dominating the midterm and spotting a couple errors in the homework writeup, the professor offers to turn the class into independent study.  For topics to study, I suggest the proof of the element uniqueness lowerbound in the comparison model of computation.  Alan Siegel sends me this nice proof in email.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;The E. U. LB is trivial.&lt;br /&gt;&lt;br /&gt;You need to know what it says: given a set of n numbers, a&lt;br /&gt;comparison-based algorithm that can solve EU does enough comparisons&lt;br /&gt;to determine the sorted order of the data.&lt;br /&gt;&lt;br /&gt;Proof in a nutshell. An adversary covers up the numbers but&lt;br /&gt;performs all comparisons and tells the truth (which can be checked&lt;br /&gt;at termination time.)&lt;br /&gt;&lt;br /&gt;The data is distinct, so there are no equalities, but the adversary&lt;br /&gt;is free to change the data as long as all of the tested comparisons&lt;br /&gt;are still as stated.&lt;br /&gt;&lt;br /&gt;So the EU program runs, decides it is done, and halts with the claim that&lt;br /&gt;the data elts are distinct.   Waaalllll ... let each comparison&lt;br /&gt;be a directed edge between data elements.  So the EU program builds a&lt;br /&gt;DAG.  If the DAG has a unique topologincal sort, the comparisons&lt;br /&gt;determine the sort. If not, there are two elements that could be equal.&lt;br /&gt;&lt;br /&gt;(Run the old fashion ready set---blocked set Top Sort). If there are&lt;br /&gt;ever two elts in the ready set they could be made equal since there is&lt;br /&gt;no path from one to the other. (Technically, reducing $x$ just changes&lt;br /&gt;all of its predecessors in the DAG by the same value.)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Basically the idea is that you are an adversary, you force the algorithm to discover enough information to sort the elements, and then you apply the sorting lower bound to show that it must have made O(n log n) comparisons.  The proof is nice and elegant.&lt;br /&gt;&lt;br /&gt;So thank you, Martin Farach-Colton, for letting me make a fool out of myself in front of ~100 people, so now I understand a proof that I&apos;ll never let myself forget.</description>
  <comments>http://ru-linux-geek.livejournal.com/35523.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/34995.html</guid>
  <pubDate>Sun, 09 Dec 2007 06:03:09 GMT</pubDate>
  <title>My recent obsession, French toast</title>
  <link>http://ru-linux-geek.livejournal.com/34995.html</link>
  <description>How does French toast manage to be so awesome?  Seriously.  I just don&apos;t understand.  Bread, pretty good.  Eggs, good.  French toast, amazing.  The goodness function for eggs and bread is definitely non-linear, reaching it&apos;s maximum at an overly soaked eggy bread.&lt;br /&gt;&lt;br /&gt;And what&apos;s good with bread?  Peanut butter and bananas.  So what about a peanut butter and banana French toast sandwich?  Let&apos;s just hope these third and fourth variables don&apos;t ruin the magic; experiment to be run tomorrow.</description>
  <comments>http://ru-linux-geek.livejournal.com/34995.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>5</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/34701.html</guid>
  <pubDate>Sun, 18 Nov 2007 16:45:25 GMT</pubDate>
  <title>South Korea, don&apos;t destroy that which makes you great</title>
  <link>http://ru-linux-geek.livejournal.com/34701.html</link>
  <description>Because I am sure that not all of my 2.5 readers read BoingBoing or slashdot.  In South Korea, there are now &lt;a href=&quot;http://www.nytimes.com/2007/11/18/technology/18rehab.html?_r=2&amp;amp;hp=&amp;amp;adxnnl=1&amp;amp;oref=slogin&amp;amp;pagewanted=all&amp;amp;adxnnlx=1195402137-siZ77ybKsZRSazhdPKcTOQ&quot;&gt;internet addiction rehab boot camps&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://youtube.com/watch?v=ishS4ifP9zQ&quot;&gt;Kang Min fighting!&lt;/a&gt;</description>
  <comments>http://ru-linux-geek.livejournal.com/34701.html</comments>
  <category>korea</category>
  <category>starcraft</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/34441.html</guid>
  <pubDate>Fri, 09 Nov 2007 03:30:40 GMT</pubDate>
  <title>Representative pictures of Googlers</title>
  <link>http://ru-linux-geek.livejournal.com/34441.html</link>
  <description>My roommate just came into my room complaining that the number one Google images result for &lt;a href=&quot;http://images.google.com/images?q=%22terry%20tai%22&quot;&gt;&quot;Terry Tai&quot;&lt;/a&gt; was a picture of the Ticket to Ride cover.  Google quickly wised up, however, and is now returning an image of Carcassonne.  This led me to query for other Googlers who attended Columbia games night.  Unfortunately, Hubert Chao is way too cool and has a few of pictures of himself, but is mostly drowned out by utexas results.  David Held also lacked any Columbia board game images.  However, &lt;a href=&quot;http://images.google.com/images?q=%22rob%20renaud%22&quot;&gt;my number one result&lt;/a&gt; is Blue Moon City.  &lt;a href=&quot;http://images.google.com/images?q=%22ross%20fairgrieve%22&quot;&gt;Ross Fairgrieve&lt;/a&gt; returns Ticket to Ride at #5 and Tigris &amp; Euphrates at #6.  &lt;a href=&quot;http://images.google.com/images?q=%22michael%20grigoriev%22&quot;&gt;Michael Grigoriev&lt;/a&gt; has Majaraja at #1 and Diplomacy at #2.&lt;br /&gt;&lt;br /&gt;I an quite a fan of Blue Moon City, and Ross liked both Tigris and Ticket to Ride.  &lt;br /&gt;&lt;br /&gt;And of course, I can&apos;t let things like rankings changes remove the greatness of these results, so here are some screen caps that will live forever, or at least until I rm -rf my home directory on ruslug.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://images.google.com/images?q=%22terry%20tai%22&quot;&gt;&quot;&lt;img src=&quot;http://ruslug.rutgers.edu/~rrenaud/ttai_image_search.jpg&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://images.google.com/images?q=%22rob%20renaud%22&quot;&gt;&lt;img src=&quot;http://ruslug.rutgers.edu/~rrenaud/rrenaud_image_search.jpg&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://images.google.com/images?q=%22ross%20fairgrieve%22&quot;&gt;&lt;img src=&quot;http://ruslug.rutgers.edu/~rrenaud/fairgr_image_search.jpg&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://images.google.com/images?q=%22michael%20grigoriev%22&quot;&gt;&lt;img src=&quot;http://ruslug.rutgers.edu/~rrenaud/mag_image_search.jpg&quot;&gt;&lt;/a&gt;</description>
  <comments>http://ru-linux-geek.livejournal.com/34441.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/34196.html</guid>
  <pubDate>Mon, 05 Nov 2007 14:11:11 GMT</pubDate>
  <title>My sister is famous</title>
  <link>http://ru-linux-geek.livejournal.com/34196.html</link>
  <description>Or at least, the Star Ledger quoted &lt;a href=&quot;http://www.nj.com/starledger/stories/index.ssf?/base/news-8/119424122975880.xml&amp;amp;coll=1&quot;&gt;Kate Renaud&lt;/a&gt; about why she does programming contests.  &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&quot;My friends ask, &apos;Why would you do that?&apos;&quot; said Kaitlin Renaud, 20, a Princeton junior, admitting it&apos;s difficult to explain to non-programmers the allure of rising early on a Sunday morning to do battle on a screen. &quot;I really can&apos;t tell them. ... But it&apos;s fun.&quot;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I guess that&apos;s better than &quot;because my brother makes me.&quot;&lt;br /&gt;&lt;br /&gt;Apparently, she finished 13th with a 2 person team.  Rutgers places were somewhat disappointing, its best team at 12th. Cornell absolutely dominated the contest, finishing all the problems with more than half the time remaining.  The &lt;a href=&quot;http://www.acmgnyr.org/year2007/standings.shtml&quot;&gt;2007 standings are here&lt;/a&gt;.</description>
  <comments>http://ru-linux-geek.livejournal.com/34196.html</comments>
  <category>icpc</category>
  <category>acm</category>
  <category>greater new york</category>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/33892.html</guid>
  <pubDate>Sat, 03 Nov 2007 19:17:40 GMT</pubDate>
  <title>In praise of Ubuntu</title>
  <link>http://ru-linux-geek.livejournal.com/33892.html</link>
  <description>I just bought a music CD (gasp, the horror!).  Ubuntu made ripping it to ogg so incredibly easy that I had extracted the first song before I even knew what format I was writing in.  Literally it was 10 seconds between right clicking the CD icon on my desktop to starting the rip.</description>
  <comments>http://ru-linux-geek.livejournal.com/33892.html</comments>
  <category>ubuntu</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://ru-linux-geek.livejournal.com/33728.html</guid>
  <pubDate>Sat, 03 Nov 2007 19:14:33 GMT</pubDate>
  <title>iLike, you have eaten my metaphorical lunch</title>
  <link>http://ru-linux-geek.livejournal.com/33728.html</link>
  <description>I discovered a pretty cool and useful Facebook app named &lt;a href=&quot;http://www.ilike.com/&quot;&gt;iLike&lt;/a&gt; a few days ago.  It implements the &quot;show me bands I like who are touring near me&quot; very well, and it has all other nice kinds of social features built in.  It&apos;s done way better than something that I could hack up in my spare time, and hence, I quit!  &lt;br /&gt;&lt;br /&gt;My only complaint is that it&apos;s very much designed for itunes and it doesn&apos;t provide a way to automatically import data from anywhere else.  The interface does support a comma separated line input for favorite bands, however.  So I hacked up a &lt;a href=&quot;http://ruslug.rutgers.edu/~rrenaud/pandora_parser.py&quot;&gt;Pandora scraper&lt;/a&gt;.  The Pandora scraper will get not just favorites, but also bands that you simply thumbed up more than once.  As a bonus, it will print scores for each artist that are in your stations.  It will run with any non-ancient version of Python, I tested with 2.4.&lt;br /&gt;&lt;br /&gt;Here are the top 5 scores for me.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
rob:~/code/more_live_music/src$ python pandora_parser.py rrenaud@gmail.com | head -n 5
Alanis Morissette 30
The Doors 28
Foo Fighters 26
Oasis 20
Red Hot Chili Peppers 18
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The scores are simply the number thumbed up songs + 10 bonus for being in favorites.  &lt;br /&gt;&lt;br /&gt;Speaking of Pandora, please, please get a clue with your ads.  I was listening to a station titled &quot;Brett Dennen Radio&quot;, my location is set to New York, NY, and Brett had a show in New York in 3 days.  What kind of ads was I seeing?  McDonald&apos;s ads.  Hint, I am a vegetarian, that&apos;s also in my profile.  With ads targeted that poorly, maybe they just don&apos;t want to earn any money?</description>
  <comments>http://ru-linux-geek.livejournal.com/33728.html</comments>
  <category>ilike</category>
  <category>pandora</category>
  <category>hacking</category>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
</channel>
</rss>
