<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>algorithms &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/algorithms/</link>
	<description>Feed of posts on WordPress.com tagged "algorithms"</description>
	<pubDate>Sat, 28 Nov 2009 21:01:00 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[An Introduction to the Lattice Boltzmann Method]]></title>
<link>http://vgramanathan.wordpress.com/2009/11/28/introduction-to-lb/</link>
<pubDate>Sat, 28 Nov 2009 07:30:36 +0000</pubDate>
<dc:creator>Ramanathan Vishnampet</dc:creator>
<guid>http://vgramanathan.wordpress.com/2009/11/28/introduction-to-lb/</guid>
<description><![CDATA[Lattice Boltzmann methods (LBM) is a class of computational fluid dynamics (CFD) methods for fluid s]]></description>
<content:encoded><![CDATA[Lattice Boltzmann methods (LBM) is a class of computational fluid dynamics (CFD) methods for fluid s]]></content:encoded>
</item>
<item>
<title><![CDATA[Two problems from the local ACM ICPC in FCIS Ain Shams]]></title>
<link>http://hatemabdelghani.wordpress.com/2009/11/27/two-problems-from-the-local-acm-icpc-in-fcis-ain-shams-oct-2009/</link>
<pubDate>Fri, 27 Nov 2009 12:07:40 +0000</pubDate>
<dc:creator>Hatem Abdelghani</dc:creator>
<guid>http://hatemabdelghani.wordpress.com/2009/11/27/two-problems-from-the-local-acm-icpc-in-fcis-ain-shams-oct-2009/</guid>
<description><![CDATA[It has been a long time since I last posted here. Since this is the Eid and I have enough time to wa]]></description>
<content:encoded><![CDATA[It has been a long time since I last posted here. Since this is the Eid and I have enough time to wa]]></content:encoded>
</item>
<item>
<title><![CDATA[The Knapsack Problem and its possible applications on Amazon.com]]></title>
<link>http://irjejune.wordpress.com/2009/11/26/the-knapsack-problem-and-its-possible-applications-on-amazon-com/</link>
<pubDate>Thu, 26 Nov 2009 23:32:02 +0000</pubDate>
<dc:creator>wanderlust</dc:creator>
<guid>http://irjejune.wordpress.com/2009/11/26/the-knapsack-problem-and-its-possible-applications-on-amazon-com/</guid>
<description><![CDATA[I&#8217;ve never been much of an online shopper. I avoided shopping online as much as I could. Until]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I&#8217;ve never been much of an online shopper. I avoided shopping online as much as I could. Until recently.</p>
<p>I discovered Amazon&#8217;s <a href="http://www.mturk.com">Mechanical Turk</a> just before I left India. I created an ID with my India address and forgot all about it.</p>
<p>Until a few weeks back. I made some money on MTurk by participating in surveys, transcription, stuff like that. And then I wanted to transfer it to my US account.</p>
<p>Nope, nada. You can&#8217;t. You can only get it delivered to your India address. Which will take six weeks. And $4. And you can&#8217;t change the address unless you delete your account (and lose your money) and create a new one.</p>
<p>So the only other option I have is to convert it to Amazon.com balance. Which I did.</p>
<p>And after buying stuff for friends and family on the website, I now have a modest amount left to spend on myself. Let&#8217;s say I have $15.</p>
<p>I want to know what I can get for $15 in books. What sort of combinations. Woody Allen + Milan Kundera? Artemis Fowl + Le Petit Nicolas? What am I missing out on? What can I buy which is better?</p>
<p>So&#8230; this can be considered a knapsack problem. It occurred to me after my situation reminded me of this xkcd cartoon:<br />
<a href="http://xkcd.com/287/"><img class="alignnone" title="NP Complete problems in restaurants" src="http://imgs.xkcd.com/comics/np_complete.png" alt="XKCD travelling salesman + knapsack problem" width="456" height="302" /></a></p>
<p>So what is the Knapsack problem? I&#8217;ll explain the simpler, more common 0/1 Knapsack Problem. So you have a set of items. Each item has a weight <em>w</em> and a value <em>v. </em>The knapsack can hold at most a weight of W. The problem is to choose which items to fill in the knapsack, such as to maximize the total V in the knapsack, while keeping the total weight under W. You can learn more <a href="http://en.wikipedia.org/wiki/Knapsack_problem">here</a>.</p>
<p>My Amazon.com problem can be considered a knapsack problem with the weight <em>w</em> of each item as its price, and the value <em>v</em> as how much Amazon thinks I&#8217;ll like the item. That of course is possible using collaborative filtering (yes! I know a term!) and other techniques. They can also use their &#8216;frequently bought together&#8217; feature here.</p>
<p>Would others find it useful? Yes, if they are on a fixed budget like I am. Or if they want to buy just enough to be eligible for Free Super Saver Shipping.</p>
<p>Would it be possible in real time? I&#8217;m sure something can be worked out there.</p>
<p>And&#8230;. crowdsourcing this&#8230; any recommendations for nice books worth buying under $15?</p>
<p>On an aside, it&#8217;d be nice if WordPress.com had suggestions for most-frequent tags, and asked if we want these tags to be converted into categories.</p>
<p>And&#8230; Happy Thanksgiving! Wish you the best of Black Friday deals!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Algorithms &amp; Parts]]></title>
<link>http://wordpressak.wordpress.com/2009/11/26/algorithms-parts/</link>
<pubDate>Thu, 26 Nov 2009 11:51:08 +0000</pubDate>
<dc:creator>wordpressak</dc:creator>
<guid>http://wordpressak.wordpress.com/2009/11/26/algorithms-parts/</guid>
<description><![CDATA[Dynamic Programming Algorithms: This class remembers older results and attempts to use this to speed]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><ul>
<li><span style="font-size:small;"><strong>Dynamic Programming Algorithms: </strong>This class remembers older results and attempts to use this to speed the process of finding new results.</span></li>
<li><span style="font-size:medium;"><span style="font-size:small;"><span style="color:#ff0000;">गतिशील प्रोग्रामिंग एल्गोरिदम: यह वर्ग याद </span></span><span style="font-size:small;"><span style="color:#ff0000;">पुराने परिणाम और इस प्रयोग को गति प्रयास </span></span><span style="font-size:small;"><span style="color:#ff0000;">नई परिणाम पाने की प्रक्रिया.
<p></span></span></span></li>
<li><span style="font-size:small;"><strong>Greedy Algorithms: </strong>Greedy algorithms attempt not only to find a solution, but to find the ideal solution to any given problem.</span></li>
<li><span style="font-size:medium;"><span style="color:#ff0000;"><span style="font-size:small;">लालची एल्गोरिदम: लालची एल्गोरिदम को ही करने की कोशिश नहीं </span></span><span style="color:#ff0000;"><span style="font-size:small;">एक समाधान है, लेकिन किसी के लिए आदर्श समाधान </span></span><span style="color:#ff0000;"><span style="font-size:small;">दी समस्या है.
<p></span></span></span></li>
<li><span style="font-size:small;"><strong>Brute Force Algorithms: </strong>The brute force approach starts at some random point and iterates through every possibility until it finds the solution.</span></li>
<li><span style="font-size:medium;"><span style="font-size:small;"><span style="color:#ff0000;">जानवर सेना एल्गोरिदम: जानवर बल दृष्टिकोण शुरू </span><span style="color:#ff0000;">कुछ बेतरतीब बिंदु पर और हर माध्यम से iterates </span><span style="color:#ff0000;">जब तक यह समाधान पाता है संभावना है.
<p></span></span></span></li>
<li><span style="font-size:small;"><strong>Randomized Algorithms: </strong>This class includes any algorithm that uses a random number at any point during its process.</span></li>
<li><span style="font-size:medium;"><span style="font-size:small;"><span style="color:#ff0000;">यादृच्छिक एल्गोरिदम: यह वर्ग किसी भी शामिल है एल्गोरिथ्म </span><span style="color:#ff0000;">कि किसी भी बिंदु पर एक यादृच्छिक संख्या के दौरान प्रयोग करता है अपनी </span><span style="color:#ff0000;">प्रक्रिया.
<p></span></span></span></li>
<li><span style="font-size:small;"><strong>Branch and Bound Algorithms: </strong>Branch and bound algorithms form a tree of subproblems to the primary problem, following each branch until it is either solved or lumped in with another branch.</span></li>
<li><span style="font-size:medium;"><span style="font-size:small;"><span style="color:#ff0000;">शाखा और बन्धे एल्गोरिदम: शाखा और बाध्य एल्गोरिदम </span></span><span style="font-size:small;"><span style="color:#ff0000;">प्राथमिक समस्या subproblems के एक पेड़ के फार्म का, </span></span><span style="font-size:small;"><span style="color:#ff0000;">प्रत्येक शाखा जब तक यह भी हल हो या lumped है निम्नलिखित </span></span><span style="font-size:small;"><span style="color:#ff0000;">में एक और शाखा के साथ. </span>
<p></span></span></li>
<li><span style="font-size:small;"><strong>Simple Recursive Algorithms:</strong> This type of algorithm goes for a direct solution immediately, then backtracks to find a simpler solution.</span></li>
<li><span style="font-size:medium;"><span style="color:#ff0000;"><span style="font-size:small;">सरल रिकर्सिव एल्गोरिदम: कलन विधि इस प्रकार है </span></span><span style="color:#ff0000;"><span style="font-size:small;">सीधा समाधान के लिए तुरंत, तो backtracks को </span></span><span style="color:#ff0000;"><span style="font-size:small;">एक सरल समाधान.</span></span><span style="font-size:small;">
<p></span></span></li>
<li><span style="font-size:small;"><strong>Backtracking Algorithms: </strong>Backtracking algorithms test for a solution, if one is found the algorithm has solved, if not it recurs once and tests again, continuing until a solution is found.</span></li>
<li><span style="font-size:medium;"><span style="font-size:small;"><span style="color:#ff0000;">पीछे हट एल्गोरिदम: परीक्षण के लिए एल्गोरिदम पीछे हट </span><span style="color:#ff0000;">एक समाधान है, अगर एक ही पाया जाता है एल्गोरिथ्म सुलझ गया है, अगर </span><span style="color:#ff0000;">ऐसा नहीं है और एक बार फिर परीक्षण बारंबार है, जब तक जारी </span><span style="color:#ff0000;">समाधान मिल गया है. </span>
<p></span></span></li>
<li><span style="font-size:small;"><strong>Divide and Conquer Algorithms:</strong> A divide and conquer algorithm is similar to a branch and bound algorithm, except it uses the backtracking method of recurring in tandem with dividing a problem into subproblems.</span></li>
<li><span style="font-size:medium;"><span style="font-size:small;"><span style="color:#ff0000;">फूट डालो और राज एल्गोरिदम: एक और विभाजन को जीत </span></span><span style="font-size:small;"><span style="color:#ff0000;">एल्गोरिथ्म एक शाखा है और बाध्य एल्गोरिथ्म के समान है, </span></span><span style="font-size:small;"><span style="color:#ff0000;">सिवाय उस में आवर्ती के पीछे हट विधि का उपयोग करता है </span></span><span style="font-size:small;"><span style="color:#ff0000;">subproblems में एक समस्या विभाजन के साथ मिलकर.</span></span></span></li>
</ul>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Google says ‘sorry’ for Michelle Obama’s racist caricature]]></title>
<link>http://newshyderabad.wordpress.com/2009/11/26/google-says-%e2%80%98sorry%e2%80%99-for-michelle-obama%e2%80%99s-racist-caricature/</link>
<pubDate>Thu, 26 Nov 2009 11:09:05 +0000</pubDate>
<dc:creator>seoforever</dc:creator>
<guid>http://newshyderabad.wordpress.com/2009/11/26/google-says-%e2%80%98sorry%e2%80%99-for-michelle-obama%e2%80%99s-racist-caricature/</guid>
<description><![CDATA[Google has apologised for a racist caricature of Michelle Obama that became the top result for users]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://newshyderabad.wordpress.com/files/2009/11/sci-michelle.jpg"><img class="aligncenter size-full wp-image-7183" title="-SCI-MICHELLE" src="http://newshyderabad.wordpress.com/files/2009/11/sci-michelle.jpg" alt="" width="318" height="477" /></a></p>
<p>Google has apologised for a racist caricature of Michelle Obama that became the top result for users searching for images of the US First Lady.<br />
Anyone typing “Michelle Obama” into Google Images this morning was presented with an altered photo depicting the US president’s wife with animal features.<br />
However, the California-based Internet giant distanced itself from this by posting a message above the offensive photo.<br />
The note states, “Sometimes our search results can be offensive. We agree,” directs users to a page explaining the technology giant’s policy on “disturbing” search results, The Telegraph reported.<br />
The message makes it clear that the Michelle Obama image is not endorsed by Google, but indicates that the company will take no action to have it removed.<br />
“Google views the integrity of our search results as an extremely important priority,” it states.<br />
“Accordingly, we do not remove a page from our search results simply because its content is unpopular or because we receive complaints concerning it.” it added.<br />
“We apologise if you’ve had an upsetting experience using Google. We hope you understand our position regarding offensive results,” it ends.<br />
Google search result rankings are determined by complex algorithms that take into account a number of factors. A powerful element in the calculations is how many other sites on the Internet link to an image or web page from the search term text.<br />
This means it is possible for mischievous web users to artificially inflate a search ranking in a process known as “Google bombing”, although this usually requires the coordinated efforts of thousands of people, the report said.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Importunate Permutations]]></title>
<link>http://simpleprogrammer.com/2009/11/24/importunate-permutations/</link>
<pubDate>Tue, 24 Nov 2009 18:07:37 +0000</pubDate>
<dc:creator>jsonmez</dc:creator>
<guid>http://simpleprogrammer.com/2009/11/24/importunate-permutations/</guid>
<description><![CDATA[Here is an interesting programming problem: Calculate all the permutations of a particular string. F]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Here is an interesting programming problem:</p>
<p>Calculate all the permutations of a particular string.</p>
<p>For Example:</p>
<p>The permutations of &#8220;abc&#8221; are</p>
<p>abc</p>
<p>acb</p>
<p>bac</p>
<p>bca</p>
<p>cab</p>
<p>cba</p>
<p>It is not as easy of a problem as it seems, but it has a rather simple solution.</p>
<p>Many times recursion is actually more complex to understand than a non-recursive solution, but in this case recursion is an elegant and simple solution.</p>
<p>A good way to solve these kinds of problems is to start with N, N+1, N+2, then solve for N+x.</p>
<p>Lets start with N, we will define a function permutation which will give us the permutations of any string.</p>
<p>permutation(&#8220;a&#8221;) =</p>
<p>&#8220;a&#8221;</p>
<p>permutation(&#8220;ab&#8221;) =</p>
<p>&#8220;a&#8221; + permutation(&#8220;b&#8221;)</p>
<p>&#8220;b&#8221; + permutation(&#8220;a&#8221;)</p>
<p>permutation(&#8220;abc&#8221;) =</p>
<p>&#8220;a&#8221; + permutation(&#8220;bc&#8221;)</p>
<p>&#8220;b&#8221; + permutation(&#8220;ac&#8221;)</p>
<p>&#8220;c&#8221; + permutation(&#8220;ab&#8221;)</p>
<p>permutation(x)</p>
<p>foreach character c in x</p>
<p>c + permutation(x remove c)</p>
<p>Looking it is in C# code it would like something like:</p>
<pre class="brush: csharp;">
public static List&#60;string&#62; Permutations(string s)
{
      if (s.Length == 1)
      {
            return new List&#60;string&#62; { s };
      }

      List&#60;string&#62; permutations = new List&#60;string&#62;();

      foreach (char c in s)
      {
            string leftOver = s.Replace(c.ToString, &#34;&#34;);
            List&#60;string&#62; stringsReturned = Permutations(leftOver);
            foreach (string permutation in stringsReturned)
            {
                 permutations.Add(c + permutation);
            }
       }
       return permutations;

}
</pre>
<p>Update: Here is a pretty slick example in LINQ that I got from a stackoverflow.com <a href="http://stackoverflow.com/questions/774457/combination-generator-in-linq" target="_blank">question</a>.</p>
<pre class="brush: csharp;">
public static IEnumerable&#60;string&#62; GetPermutations(string s)
{
    if (s.Count() &#62; 1)
        return from ch in s
               from permutation in GetPermutations(s.Remove(s.IndexOf(ch), 1))
               select string.Format(&#34;{0}{1}&#34;, ch, permutation);

    else
        return new string[] { s };
}
</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Banana Nut Bread Algorithm (Reprinted)]]></title>
<link>http://computerforumz.wordpress.com/2009/11/23/banana-nut-bread-algorithm-reprinted/</link>
<pubDate>Mon, 23 Nov 2009 19:08:26 +0000</pubDate>
<dc:creator>The Doctor</dc:creator>
<guid>http://computerforumz.wordpress.com/2009/11/23/banana-nut-bread-algorithm-reprinted/</guid>
<description><![CDATA[This is an old family algorithm first published in a Church cookbook more than 50 years ago&#8230; M]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This is an old family algorithm first published in a Church cookbook more than 50 years ago&#8230;</p>
<p><strong>Mrs. Illik&#8217;s Banana Nut Bread</strong></p>
<p>&#8211; 1 cup sugar<br />
&#8211; 1/2 cup butter (one stick)<br />
&#8211; 2 eggs<br />
&#8211; 3 bananas (mashed)<br />
&#8211; 2 cups flour<br />
&#8211; 1 teaspoon soda<br />
&#8211; 1/2 teaspoon salt<br />
&#8211; 1/2 cup chopped nuts</p>
<p>Cream sugar and butter, add beaten eggs, and add mashed bananas together.</p>
<p>Mix in dry ingredients and add nuts.</p>
<p>Bake in greased bread pan at 350 degrees for at least one hour.  The bread is done when it pulls away from the sides of the pan.</p>
<p>Makes one loaf.</p>
<p>All measurements are in American standard.</p>
<p>Happy Holidays!!!</p>
<p>__________________<br />
(\__/)<br />
(=&#8217;.'=) This is Bunny. Copy and paste bunny into your<br />
(&#8220;)_(&#8220;) signature to help him gain world domination.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[New Streaming Algorithms for Old Problems]]></title>
<link>http://rjlipton.wordpress.com/2009/11/22/new-streaming-algorithms-for-old-problems/</link>
<pubDate>Sun, 22 Nov 2009 14:19:36 +0000</pubDate>
<dc:creator>rjlipton</dc:creator>
<guid>http://rjlipton.wordpress.com/2009/11/22/new-streaming-algorithms-for-old-problems/</guid>
<description><![CDATA[A streaming algorithm for the classic Dyck language Claire Mathieu, previously Claire Kenyon, is an ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><font color="”#0066cc?"><br />
<em> A streaming algorithm for the classic Dyck language</em><br />
<font color="”#000000?"></p>
<p><a href="http://rjlipton.wordpress.com/files/2009/11/images5.jpeg"><img src="http://rjlipton.wordpress.com/files/2009/11/images5.jpeg" alt="" title="images" width="77" height="116" class="alignright size-full wp-image-3884" /></a></p>
<p>
Claire Mathieu, previously Claire Kenyon, is an expert in the design and analysis of algorithms, which should be no surprise since she worked as a graduate student with two of the world&#8217;s best&#8212;Philippe Flajolet and Jeffrey Vitter. Claire has done and continues to do some very pretty work on all aspects of algorithms. </p>
<p>
Today I plan to talk about a recent paper of Frédéric Magniez, Claire Mathieu, and Ashwin Nayak on streaming algorithms, and how it relates to work that was in vogue years ago.<br />
<!--more--></p>
<p>
I recall one day at Princeton when Bob Sedgewick and I had, what we thought, was a great idea. At the time we were working on a front end to <strong>TeX</strong>, which we called &#8220;notech.&#8221; </p>
<p>
Notech was a preprocessor to <strong>TeX</strong> that extended some of the ideas that Don Knuth put into <strong>TeX</strong>: except we carried them to the extreme. Let me explain. Before <strong>TeX</strong> there were other languages that were typesetting languages. One was called <a href="http://en.wikipedia.org/wiki/Troff">Troff</a>, and was developed at Bell Labs as part of the UNIX project. Troff was not bad&#8212;for example, many textbooks were written with it&#8212;but it had serious limitations. My first typeset paper was done with it, but Troff&#8217;s limits helped drive Knuth to invent <strong>TeX</strong>.</p>
<p>
One of the features of Troff that I hated was that paragraphs were separated from each other by not a blank line as in <strong>TeX</strong>, but by the symbols <i>.PP</i>. This made the raw text very hard to read, in my opinion. In Troff this is how I would have written this paragraph: </p>
<blockquote><p>
 .PP<br />
One of the limits of Troff that I hated was that paragraphs were separated from each other by not a blank line as in TeX, but by the symbols<br />
.ft I<br />
.PP.<br />
.ft R<br />
This made the raw text very hard to read, in my opinion. In Troff this is how I would have written this paragraph:
</p></blockquote>
<p>
I will stop here&#8212;the danger of recursion scares me.</p>
<p>
I loved that <strong>TeX</strong> used the obvious rule that a blank line meant a new paragraph&#8212;what else could it mean? Bob and I worked out a series of similar rules each of the form: </p>
<blockquote><p>
 if you typed something in a &#8220;reasonable way,&#8221; notech would try, via its rules, to guess what you meant, and typeset the material appropriately.
</p></blockquote>
<p>
Notech was a pretty good guesser, and for years I used it as my own front-end to <strong>TeX</strong>. A notech file was mostly plain text&#8212;thus the name&#8212;except for math formulas. We could never figure out anything that was better than what Knuth invented for math formulas. Although we did use matching <img src='http://l.wordpress.com/latex.php?latex=%7B%5C%7B%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\{}&amp;fg=000000' title='{\{}&amp;fg=000000' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%7B%5C%7D%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\}}&amp;fg=000000' title='{\}}&amp;fg=000000' class='latex' /> as math delimiters, we left math basically alone. Here is a small part of a paper I wrote in notech:</p>
<blockquote><p>
 A key lemma for the lower bound is the following:</p>
<p>
Main Lemma: There exists a family of bounded degree directed acyclic graphs {G_n} on {n} vertices and an {\epsilon &#62; 0} so that {G_n} has no {\epsilon n}-segregator with cardinality less than {\epsilon n}.
</p></blockquote>
<p>
You might ask, what does this have to do with Claire? She is French and is of course fluent in both English and French. One day at a Princeton tea, Bob and I asked Claire a question: are there two words in French that have the same letters, but have different accents? If there were none, or if such words were rare, then we could program notech to automatically add accents to French words. This seemed to us to be a cool possibility, since accents were a pain to do in notech or <strong>TeX</strong>. </p>
<p>
Her initial response was favorable. She said that she could not, immediately, think of any French words with the same letters, that had different accents. Bob and I were excited, and we explained to her that this would allow us to write a program that would supply the missing accents, since they were <i>redundant</i>. </p>
<p>
Redundant did not go over well. Claire walked off and after a few minutes returned with a long list of words that changed with different accents. Our plan was ruined, and she had defended the French language. It would have been a great feature, in my opinion, if accents could be automatically added to a word. I still struggle to get them right&#8212;especially on names. Oh well.</p>
<p>
Let&#8217;s turn to discuss her neat paper on streaming and Dyck Languages, and leave accents behind.</p>
<p>
<p><b> Streaming for Dyck Languages </b></p>
<p><p>
Frédéric Magniez, Claire Mathieu, and Ashwin Nayak have written a pretty paper titled <a href="http://www.eccc.uni-trier.de/report/2009/119/">Recognizing well-parenthesized expressions in the streaming model</a>.</p>
<p>
The language <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7BDYCK%7D%282%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{DYCK}(2)}&amp;fg=000000' title='{\mathsf{DYCK}(2)}&amp;fg=000000' class='latex' /> is the <a href="http://en.wikipedia.org/wiki/Dyck_language">language</a> of all properly nested parenthesis expressions over two different types of paired parenthesis.</p>
<p>
The parentheses ( and ) must be paired, and the parentheses [ and ] must be paired. Thus,
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+%5B%5C%2C+%28%5C%2C+%29%5C%2C+%28+%5C%2C+%29%5C%2C+%28%5C%2C+%29%5C%2C+%5D%5C%2C+%5B%5C%2C+%28%5C%2C+%29%5C%2C+%5D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle [\, (\, )\, ( \, )\, (\, )\, ]\, [\, (\, )\, ]&amp;fg=000000' title='\displaystyle [\, (\, )\, ( \, )\, (\, )\, ]\, [\, (\, )\, ]&amp;fg=000000' class='latex' /></p>
<p> is in the language and
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+%5B%5C%2C%28%5C%2C%5D%5C%2C%29%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle [\,(\,]\,)&amp;fg=000000' title='\displaystyle [\,(\,]\,)&amp;fg=000000' class='latex' /></p>
<p> is not. More precisely, the empty string is in the Dyck language; and if <img src='http://l.wordpress.com/latex.php?latex=%7BX%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{X}&amp;fg=000000' title='{X}&amp;fg=000000' class='latex' /> is in the language, then so is <img src='http://l.wordpress.com/latex.php?latex=%7B%28X%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{(X)}&amp;fg=000000' title='{(X)}&amp;fg=000000' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%7B%5BX%5D%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{[X]}&amp;fg=000000' title='{[X]}&amp;fg=000000' class='latex' />. Yes, there is a language <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7BDYCK%7D%283%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{DYCK}(3)}&amp;fg=000000' title='{\mathsf{DYCK}(3)}&amp;fg=000000' class='latex' />, which has three types of paired parenthesis, and <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7BDYCK%7D%284%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{DYCK}(4)}&amp;fg=000000' title='{\mathsf{DYCK}(4)}&amp;fg=000000' class='latex' /> has four, and so on. A simple insight is that <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7BDYCK%7D%282%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{DYCK}(2)}&amp;fg=000000' title='{\mathsf{DYCK}(2)}&amp;fg=000000' class='latex' /> is already the &#8220;general case&#8221; for the streaming problem. </p>
<p>
They prove:</p>
<blockquote><p><b>Theorem: </b> <em> There is a one-pass randomized streaming algorithm for <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7BDYCK%7D%282%29%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{DYCK}(2)}&amp;bg=e8e8e8&amp;fg=000000' title='{\mathsf{DYCK}(2)}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> with space <img src='http://l.wordpress.com/latex.php?latex=%7BO%28%5Csqrt+n+%5Clog+n%29%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{O(\sqrt n \log n)}&amp;bg=e8e8e8&amp;fg=000000' title='{O(\sqrt n \log n)}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> and time <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7Bpolylog%7D%28n%29%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{polylog}(n)}&amp;bg=e8e8e8&amp;fg=000000' title='{\mathsf{polylog}(n)}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />. If the stream belongs to <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7BDYCK%7D%282%29%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{DYCK}(2)}&amp;bg=e8e8e8&amp;fg=000000' title='{\mathsf{DYCK}(2)}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> then the algorithm accepts it with probability <img src='http://l.wordpress.com/latex.php?latex=%7B1%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{1}&amp;bg=e8e8e8&amp;fg=000000' title='{1}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />; otherwise it rejects it with probability at least <img src='http://l.wordpress.com/latex.php?latex=%7B1-n%5E%7B-c%7D%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{1-n^{-c}}&amp;bg=e8e8e8&amp;fg=000000' title='{1-n^{-c}}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> where <img src='http://l.wordpress.com/latex.php?latex=%7Bc%26%2362%3B0%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{c&gt;0}&amp;bg=e8e8e8&amp;fg=000000' title='{c&gt;0}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> is a constant. </em></p></blockquote>
<p><p>
They also prove a lower bound that almost matches their algorithm&#8217;s space bound. I really like their result. First, it uses a non-trivial method to manage a potentially large stack, which, I believe, could be used in other streaming algorithms. Second, their result is related to an old language theory result that I will discuss in the next section. I like the connection between the current hot topic of streaming and an old topic. </p>
<p>
Here is a short overview of how they prove their theorem. As usual please look at their paper for the full proof.</p>
<p>
It may help to explain the naïve&#8212;note the accent&#8212;algorithm for determining whether or not a string is in <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7BDYCK%7D%282%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{DYCK}(2)}&amp;fg=000000' title='{\mathsf{DYCK}(2)}&amp;fg=000000' class='latex' />. The algorithm uses a pushdown, which is initially empty. I will abuse the definitions a bit and call the pushdown a stack: recall a stack, in language theory, allows more operations that just push and pop.</p>
<p>
The algorithm processes each input symbol in turn; thus, there are four cases based on the current input symbol: </p>
<ol>
<li> The input is (. In this case just push the symbol onto the stack.
<li> The input is [. In this case also just push the symbol onto the stack.
<li> The input is ). In this case check that the top most symbol is a matching (. If it is not, then reject; otherwise, pop off the top of the stack.
<li> The input is ]. In this case check that the top most symbol is a matching [. If it is not, then reject; otherwise, pop off the top of the stack.
</ol>
<p>
When there is no more input, the algorithm accepts if and only if the stack is empty. It is not hard to see that this algorithm works correctly with only one pass over the input. Note, the string
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+%5B%5C%2C%28%5C%2C%5D%5C%2C%29%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle [\,(\,]\,)&amp;fg=000000&#8242; title=&#8217;\displaystyle [\,(\,]\,)&amp;fg=000000&#8242; class=&#8217;latex&#8217; /></p>
<p> will be rejected because at the third input symbol the stack will be
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+%5Cstackrel%7B%5Cbig+%28%7D%7B%5B%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle \stackrel{\big (}{[}&amp;fg=000000' title='\displaystyle \stackrel{\big (}{[}&amp;fg=000000' class='latex' /></p>
<p> and the input is <img src='http://l.wordpress.com/latex.php?latex=%7B%5D%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{]}&amp;fg=000000' title='{]}&amp;fg=000000' class='latex' />. Since the top does not pair off with the input, rule (4) forces the algorithm to reject. </p>
<p>
Their clever insight is that it is possible to simulate the stack with much less space, than used by the naïve algorithm. Note, the stack can get as large as order <img src='http://l.wordpress.com/latex.php?latex=%7Bn%2F2%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{n/2}&amp;fg=000000' title='{n/2}&amp;fg=000000' class='latex' /> in size for a string that is in the Dyck language: just have an input that starts with many ( and [ symbols. </p>
<p>
The key idea is that the contents of the stack can be hashed, and in this manner the space requirements can be reduced from order <img src='http://l.wordpress.com/latex.php?latex=%7Bn%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{n}&amp;fg=000000' title='{n}&amp;fg=000000' class='latex' /> to almost <img src='http://l.wordpress.com/latex.php?latex=%7B%5Csqrt+n%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\sqrt n}&amp;fg=000000' title='{\sqrt n}&amp;fg=000000' class='latex' />. The hashing is not completely straightforward---they need to carefully look at the types of motions of the stack. They must analyze how the stack can move up and down during the operation of the naïve algorithm. See their paper for the details.</p>
<p>
<p><b> The Connection to Language Theory </b></p>
<p><p>
The Dyck language, named for Walther von Dyck, is fundamental to classic language theory. It is a special type of context-free language, called <a href="http://en.wikipedia.org/wiki/Linear_grammar">linear</a>, but it is ``universal'' in a sense made precise by the beautiful <a href="http://planetmath.org/encyclopedia/ChomskySchutzenbergerTheorem.html">Chomsky-Schützenberger Theorem</a>:</p>
<blockquote><p><b>Theorem: </b> <em> A language <img src='http://l.wordpress.com/latex.php?latex=%7BL%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{L}&amp;bg=e8e8e8&amp;fg=000000' title='{L}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> over <img src='http://l.wordpress.com/latex.php?latex=%7B%5CSigma%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\Sigma}&amp;bg=e8e8e8&amp;fg=000000' title='{\Sigma}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> is context-free if and only if for some finite alphabet <img src='http://l.wordpress.com/latex.php?latex=%7B%5CGamma%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\Gamma}&amp;bg=e8e8e8&amp;fg=000000' title='{\Gamma}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />, there is a homomorphism <img src='http://l.wordpress.com/latex.php?latex=%7Bh%3A%5CGamma%5E%7B%2A%7D+%5Crightarrow+%5CSigma%5E%7B%2A%7D%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{h:\Gamma^{*} \rightarrow \Sigma^{*}}&amp;bg=e8e8e8&amp;fg=000000' title='{h:\Gamma^{*} \rightarrow \Sigma^{*}}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> such that
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle++L+%3D+h%28D+%5Ccap+R%29+%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle  L = h(D \cap R) &amp;bg=e8e8e8&amp;fg=000000' title='\displaystyle  L = h(D \cap R) &amp;bg=e8e8e8&amp;fg=000000' class='latex' /></p>
<p> where <img src='http://l.wordpress.com/latex.php?latex=%7BD+%3D+%5Cmathsf%7BDYCK%7D%28%5CGamma%29%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{D = \mathsf{DYCK}(\Gamma)}&amp;bg=e8e8e8&amp;fg=000000' title='{D = \mathsf{DYCK}(\Gamma)}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />, the Dyck language over <img src='http://l.wordpress.com/latex.php?latex=%7B%5CGamma%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\Gamma}&amp;bg=e8e8e8&amp;fg=000000' title='{\Gamma}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%7BR%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{R}&amp;bg=e8e8e8&amp;fg=000000' title='{R}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> is a regular language over <img src='http://l.wordpress.com/latex.php?latex=%7B%5CGamma%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\Gamma}&amp;bg=e8e8e8&amp;fg=000000' title='{\Gamma}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />. </em></p></blockquote>
<p>The theorem is, of course, due to Noam Chomsky and Marcel-Paul Schützenberger.</p>
<p><p>
This connection raises some interesting questions between their new streaming result and classic language theory. Can they use their method, for example, to give a streaming bound on all context-free languages?</p>
<p>
I will end this discussion by pointing out that I have already discussed a close relative to the Dyck language. Consider the <a href="http://en.wikipedia.org/wiki/Free_group">free group</a> on <img src='http://l.wordpress.com/latex.php?latex=%7B2%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{2}&amp;fg=000000' title='{2}&amp;fg=000000' class='latex' /> letters. Given a word from the free group, some words, like <img src='http://l.wordpress.com/latex.php?latex=%7Bab%5E%7B-1%7Dba%5E%7B-1%7D%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{ab^{-1}ba^{-1}}&amp;fg=000000' title='{ab^{-1}ba^{-1}}&amp;fg=000000' class='latex' /> would trivially equal <img src='http://l.wordpress.com/latex.php?latex=%7B1%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{1}&amp;fg=000000' title='{1}&amp;fg=000000' class='latex' />. Let us call the language defined by such words <img src='http://l.wordpress.com/latex.php?latex=%7BD%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{D}&amp;fg=000000' title='{D}&amp;fg=000000' class='latex' />. <img src='http://l.wordpress.com/latex.php?latex=%7BD%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{D}&amp;fg=000000' title='{D}&amp;fg=000000' class='latex' /> is like <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7BDYCK%7D%282%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{DYCK}(2)}&amp;fg=000000' title='{\mathsf{DYCK}(2)}&amp;fg=000000' class='latex' /> except that parentheses can cancel in either order: for example,
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle++%5D+%5C%2C+%29+%5C%2C+%28+%5C%2C+%5B+%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle  ] \, ) \, ( \, [ &amp;fg=000000' title='\displaystyle  ] \, ) \, ( \, [ &amp;fg=000000' class='latex' /></p>
<p> is now allowed. Sometimes the language <img src='http://l.wordpress.com/latex.php?latex=%7BD%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{D}&amp;fg=000000' title='{D}&amp;fg=000000' class='latex' /> is called, for obvious reasons, the two-sided Dyck language. </p>
<p>
Zeke Zalcstein and I showed years ago that the following is true: </p>
<blockquote><p><b>Theorem: </b> <em> There is an one-pass randomized streaming algorithm for the language <img src='http://l.wordpress.com/latex.php?latex=%7BD%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{D}&amp;bg=e8e8e8&amp;fg=000000' title='{D}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> with space <img src='http://l.wordpress.com/latex.php?latex=%7BO%28%5Clog+n%29%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{O(\log n)}&amp;bg=e8e8e8&amp;fg=000000' title='{O(\log n)}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> and time <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cmathsf%7Bpolylog%7D%28n%29%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\mathsf{polylog}(n)}&amp;bg=e8e8e8&amp;fg=000000' title='{\mathsf{polylog}(n)}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />. If the stream belongs to the free group then the algorithm accepts it with probability <img src='http://l.wordpress.com/latex.php?latex=%7B1%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{1}&amp;bg=e8e8e8&amp;fg=000000' title='{1}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />; otherwise it rejects it with probability at least <img src='http://l.wordpress.com/latex.php?latex=%7B1-n%5E%7B-c%7D%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{1-n^{-c}}&amp;bg=e8e8e8&amp;fg=000000' title='{1-n^{-c}}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> where <img src='http://l.wordpress.com/latex.php?latex=%7Bc%26%2362%3B0%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{c&gt;0}&amp;bg=e8e8e8&amp;fg=000000' title='{c&gt;0}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> is a constant. </em></p></blockquote>
<p> Well <i>not exactly</i>. As Frédéric Magniez, Claire Mathieu, and Ashwin Nayak generously point out, we proved a theorem that is equivalent to this, but we proved our theorem before there was a even a streaming model. I discussed our result and its strange history <a href="http://rjlipton.wordpress.com/2009/04/16/the-word-problem-for-free-groups/">here</a>.</p>
<p>
<p><b> Open Problems </b></p>
<p><p>
Is their upper bound tight? More fun might be to try and see what is the streaming complexity of other languages. In particular, what happens for all context-free languages? What about linear ones?</p>
<p>
Why is the Dyck language so much harder in the streaming model than the free group, the two-sided Dyck language? </p>
<p>
Also their stack idea is quite ingenious---can similar ideas be used in other algorithms? </p>
<p>[Some minor updates.]</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[These are a few of my favorite things...]]></title>
<link>http://crocescorner.wordpress.com/2009/11/21/these-are-a-few-of-my-favorite-things/</link>
<pubDate>Sat, 21 Nov 2009 03:16:26 +0000</pubDate>
<dc:creator>jencroce</dc:creator>
<guid>http://crocescorner.wordpress.com/2009/11/21/these-are-a-few-of-my-favorite-things/</guid>
<description><![CDATA[Jogging and lifting, my MamaRuth, getting a job at J.Crew, finishing my Alogorithm&#8217;s class, mo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Jogging and lifting, my MamaRuth, getting a job at J.Crew, finishing my Alogorithm&#8217;s class, moving onto to things that will last!! (Sing the melody of &#8220;My Favorite Things&#8221; when you read this line)</p>
<p>GYM &#8211; It has been a wonderful month of consistent Gym time! I am so excited with my results! Although weight has not decreased, I know my muscle has increased and my fat is being burned! I now lift 20lbs upper body and lower body 70lbs! For the next month I am not going to increase my weight, instead I am going to increase my reps. Right now I do 3 sets of 10. My jogging is the same, 2 to 3 miles. However, I may increase my incline. My incline has gone from 0 to 2. </p>
<p>MAMARUTH &#8211; I think about her often, there is not a day that goes by that I don&#8217;t. Anything and everything it seems reminds me of her. At times I cry a river and other times I smile knowing she&#8217;s in Heaven. I can only imagine the pain my mother and her brothers and sisters are going through. I fear now for the health of my parents, aunts, and uncles. I can&#8217;t help but think &#8220;Who&#8217;s next?&#8221;. I simply loathe Cancer. I signed up to be an advocate for Cancer. I am to recieve constant emails on events and things. So I&#8217;ll keep you all updated when I get more info! I have deeper future plans in this area but I do not feel the need to go into detail just yet. I was going to go visit her gravesite this week, she got her headstone. I just couldn&#8217;t muster up the courage too. I&#8217;m not sure if it&#8217;s that I don&#8217;t want to face reality once more, or that it&#8217;s all too real in general. I miss that classy lady, she taught me well!</p>
<p>J.Crew &#8211; On a different tone, I got a seasonal position with J.Crew! Today was my first day, just orientation and such. My manager said we could shop today if we wanted and I was sooo tempted, but I didn&#8217;t <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  I&#8217;ll probably stop by tomorrow instead! Hahah! It was fun and I met some cool people! I can&#8217;t wait to work! J.Crew is one of my favorite stores, so it makes it all the better. Working here also brings up some more future plans! We&#8217;ll see how everything runs though! Hubby&#8217;s job is still good (Aviation Analyst) Thank God!, good ol&#8217; San Diego! Things just keep getting better! </p>
<p>ALGORITHMS &#38; LOGIC CLASS &#8211; Wow, what can I say? I thank God that he has given me such a good outlook on this class. I have been reading and understanding. Although at times it gets a bit confusing, it doesn&#8217;t overwhelm me. Next week is my final for this class! I&#8217;m grateful that it is here and I am also grateful that as of now I am still holding an A! God is good all the time! </p>
<p>Well my friends, it seems my close is here! I will attempt to write once before Thanksgiving! However, if I don&#8217;t make it&#8230;..HAPPY THANKSGIVING EVERYONE!!</p>
<p>XoXo, J</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[An Important Message]]></title>
<link>http://hbfs.wordpress.com/2009/11/20/an-important-message/</link>
<pubDate>Fri, 20 Nov 2009 20:24:32 +0000</pubDate>
<dc:creator>Steven Pigeon</dc:creator>
<guid>http://hbfs.wordpress.com/2009/11/20/an-important-message/</guid>
<description><![CDATA[]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://hbfs.wordpress.com/files/2009/11/domo-kun-algo.gif"><img src="http://hbfs.wordpress.com/files/2009/11/domo-kun-algo.gif" alt="" title="domo-kun-algo" width="200" height="150" class="aligncenter size-full wp-image-1946" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Java Array Based Stack to find a Palindrome!]]></title>
<link>http://skud15.wordpress.com/2009/11/20/java-array-based-stack-palindrome/</link>
<pubDate>Fri, 20 Nov 2009 00:12:44 +0000</pubDate>
<dc:creator>Oliver O&#39;Mahony</dc:creator>
<guid>http://skud15.wordpress.com/2009/11/20/java-array-based-stack-palindrome/</guid>
<description><![CDATA[How many buzz words can you fit in a title? Microsoft and other companies often request you to compl]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>How many buzz words can you fit in a title?</p>
<p>Microsoft and other companies often request you to complete some algorithms in their interviewing process. Today I completed an attempt at an ArrayBasedStack to be able to find a palindrome. Something I must admit I have not touched since early college! This is going to be the first of some interview questions I got. Plus it is about time I wrote another blog post.</p>
<p>Using the excellent: <a href="http://ww0.java4.datastructures.net/" target="_blank">Data Structures and Algorithms in Java</a> by G&#38;T to define my <a href="http://ww0.java4.datastructures.net/source/ch04/Java/Stack-Stack.html" target="_blank">stack</a> I created an <a href="http://ww0.java4.datastructures.net/source/ch04/Java/ArrayStack-ArrayStack.html" target="_blank">array based stack</a> similar to what they have posted. Each developer has their own style. I prefer using return size() == 0 rather than their (top &#60; 0), but that is my preference.</p>
<p>Just remember a few things</p>
<p><em>A <strong>palindrome</strong> is a word, phrase, <a title="Palindromic number" href="http://en.wikipedia.org/wiki/Palindromic_number">number</a> or other sequence of units that can be read the same way in either direction (the adjustment of punctuation and spaces between words is generally permitted) &#8211; from wiki</em></p>
<p>Trim whitespace and lowercase the characters.</p>
<p>Stacks work on last in, first out principle. What? Well this comes in handy for the algorithm. LIFO gives you a reverse effect.</p>
<p>So &#8211; here it is, the algorithm. Hope it will help you with your stack based palindromes.</p>
<pre><span style="color:#000000;">private boolean isPalindrome(String str) {</span></pre>
<pre style="text-align:justify;padding-left:30px;"><span style="color:#000000;"> Stack&#60;Character&#62; stack = new ArrayBasedStack</span>&#60;Character&#62;<span style="color:#000000;">(str.length());
 str = str.toLowerCase().trim();</span> <span style="color:#008000;">//format the data</span>
 while(stack.size()&#60;(str.length()/2)) {
 <span style="color:#008000;"> //When the stack is less than half the length
  //(even numbers great, odd numbers ignore the middle!</span>
<pre style="padding-left:30px;">stack.push(str.charAt(stack.size()));
<span style="color:#008000;">//push the character at the position indexed by the size of the stack</span></pre>
</pre>
<pre style="padding-left:30px;"> }</pre>
<pre style="padding-left:30px;"> while(stack.size()&#62;0) { <span style="color:#008000;">//lets go back</span>
</pre>
<pre style="padding-left:60px;">if(stack.top() == str.charAt(str.length() - stack.size())) {
<span style="color:#008000;">//again use the stack size
//to index the position, minus the length
//so this counts down every time something is popped from the stack.
//You are checking the top of the stack is equal to the character
//in 2nd half of the word. since characters go in first, the characters,
//abba would have b on top and a on the bottom when hitting this loop -
//the first two characters - they are the same as the last two. Get it now? </span>
<pre style="padding-left:30px;">stack.pop(); <span style="color:#008000;">//remove <strong>palindromic</strong> characters</span></pre>
</pre>
<pre style="padding-left:60px;">} else {</pre>
<pre style="padding-left:90px;">return false; <span style="color:#008000;">//it is not a palindrome -
//you don't want to keep going and be inefficient if it is wasting time!</span></pre>
<pre style="padding-left:60px;">}</pre>
<pre style="padding-left:30px;"> }</pre>
<pre style="padding-left:30px;"> return true; <span style="color:#008000;">// if it gets here there can only be on conclusion.</span></pre>
<p style="text-align:justify;">}</p>
<p>Hope this helps and you learn my thinking behind this. Good luck with the interviews.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Alternative Search]]></title>
<link>http://notesonmedia.wordpress.com/2009/11/18/alternative-search/</link>
<pubDate>Wed, 18 Nov 2009 20:55:46 +0000</pubDate>
<dc:creator>Lasse Bo Timmermann</dc:creator>
<guid>http://notesonmedia.wordpress.com/2009/11/18/alternative-search/</guid>
<description><![CDATA[Visiting the Society of the Query Conference I had the chance to listen to many interesting talks on]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img src="http://notesonmedia.wordpress.com/files/2009/11/p1020939.jpg" alt="Society of the Query Flyer" />Visiting the <a href="http://networkcultures.org/wpmu/query/">Society of the Query Conference</a> I had the chance to listen to many interesting talks on the impact of search engines (not only Google) on our lives. The two sessions on alternative search recalled Alexander Galloway&#8217;s call for the creation of alternative algorithms to my mind. In Mary Joyce&#8217;s blog I found a nice entry on <em><a href="http://www.digiactive.org/2009/11/07/power-the-network-3-mechanisms-1-caveat/">Power &#38; the Network</a></em> that points out the relevance of such an endeavor. She writes that</p>
<blockquote><p>&#8220;[...] the challenge for people who want to encourage more effective digital activism is to figure out which content will both assist activists in creating effective campaigns and which can be disseminated most effectively online.&#8221;</p></blockquote>
<p>One way to do so and also to account for her second request, namely to provide people with </p>
<blockquote><p>[...] digital content that not only inspires and directs citizens to act, but also tells them how to act[,]</p></blockquote>
<p>could be in the creation of the algorithms mentioned above. It would hence not only be the content, as Joayce writes, but also about the techniques of dissemination. Rather than merely adapting to the protocols and pathways provided by the Web one should also open the eyes for alternatives. The Society of the Query conference provided some interesting hints in this direction. Particularly interesting to me were the <a href="http://misspelling-generator.org/">misspelling generator</a> that can for instance be used to temporarily circumvent censorship and the <a href="http://www.geuzen.org/anxiety/">anxiety monitor</a>, which provides a tool to visually compare the connotations of different keywords towards diverse cultural backgrounds. While these examples fall more in the first category and are dealing with using the available tools to provide alternatives to the default search options, the <a href="http://networkcultures.org/wpmu/query/2009/11/14/daniel-van-der-velden-nl-googlekeas-alternative-searchengine-should-dynamically-complement-the-marginal-search-returns/">approach presented by Daniel von der Velden</a> was different. His main argument for alternative search is that the interesting challenges to main stream assumptions are found at the periphery of the usual search results. The problem with thos results is that they</p>
<blockquote><p>&#8220;[...] are often not directly connected to the statement and exist isolated as isolated worlds away from the powerful, reigning opinion. Metahaven wants to develop a search engine that connects these different spheres, to provide different points of views on particular issues and be able to put emphasis on the marginal forces.</p></blockquote>
<p>To achieve these goals Metahaven strives to create maps that reveal the networks of power and provide a better overview on where the information can be found and how it is distributed. Through this they want to open up the black-boxes of cloud-computing and current search engines. Even though Metahaven attempts to provide a truly alternative search and wants to provide a greater visibility of alternate accounts something from Joyce&#8217;s requests seems to remain open. It is certainly not enough to provide the people with the information. Alternative algorithms also have to show their users <em>how to act</em>, the next step so to say. This is what will be one of the great challenges for alternative search in the future.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[An Intro to Big Oh Notation with Java]]></title>
<link>http://nerdgerl.wordpress.com/2009/11/18/an-intro-to-big-oh-notation-with-java/</link>
<pubDate>Wed, 18 Nov 2009 05:41:49 +0000</pubDate>
<dc:creator>nerdgerl</dc:creator>
<guid>http://nerdgerl.wordpress.com/2009/11/18/an-intro-to-big-oh-notation-with-java/</guid>
<description><![CDATA[Big Oh notation is used in computer science to decribe the complexity of an algorithm in terms of ti]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Big Oh notation is used in computer science to decribe the complexity of an algorithm in terms of time and space (memory). Big Oh notation describes the <strong>worst case scenario</strong> of what happens when an algorithm is run with N values and is really only useful when talking about large sets of data.</p>
<table border="1" cellspacing="0" cellpadding="4" summary="example O(N) values">
<tbody>
<tr>
<th></th>
<th><em>constant</em></th>
<th><em>logarithmic</em></th>
<th><em>linear</em></th>
<th></th>
<th><em>quadratic</em></th>
<th><em>cubic</em></th>
</tr>
<tr valign="bottom">
<th>n</th>
<th>O(1)</th>
<th>O(log N)</th>
<th>O(N)</th>
<th>O(N log N)</th>
<th>O(N<sup>2</sup>)</th>
<th>O(N<sup>3</sup>)</th>
</tr>
<tr align="right">
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr align="right">
<td>2</td>
<td>1</td>
<td>1</td>
<td>2</td>
<td>2</td>
<td>4</td>
<td>8</td>
</tr>
<tr align="right">
<td>4</td>
<td>1</td>
<td>2</td>
<td>4</td>
<td>8</td>
<td>16</td>
<td>64</td>
</tr>
<tr align="right">
<td>8</td>
<td>1</td>
<td>3</td>
<td>8</td>
<td>24</td>
<td>64</td>
<td>512</td>
</tr>
<tr align="right">
<td>16</td>
<td>1</td>
<td>4</td>
<td>16</td>
<td>64</td>
<td>256</td>
<td>4,096</td>
</tr>
<tr align="right">
<td>1,024</td>
<td>1</td>
<td>10</td>
<td>1,024</td>
<td>10,240</td>
<td>1,048,576</td>
<td>1,073,741,824</td>
</tr>
<tr align="right">
<td>1,048,576</td>
<td>1</td>
<td>20</td>
<td>1,048,576</td>
<td>20,971,520</td>
<td>10<sup>12</sup></td>
<td>10<sup>16</sup></td>
</tr>
</tbody>
</table>
<p style="text-align:left;">
<div id="attachment_199" class="wp-caption aligncenter" style="width: 528px"><a href="http://nerdgerl.wordpress.com/files/2009/11/scale_plot1.jpg"><img class="size-full wp-image-199" title="Big Oh Complexity Over Time" src="http://nerdgerl.wordpress.com/files/2009/11/scale_plot1.jpg" alt="" width="518" height="469" /></a><p class="wp-caption-text">Big Oh Complexity Over Time</p></div>
<p><em>Source: table source <a href="http://leepoint.net/notes-java/algorithms/big-oh/bigoh.html">here</a> also big thanks to Dean who made the graph for me <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
<h3>Explanation<em><br />
</em></h3>
<p><strong>O(1)</strong> = irrespective of changing the size of the input, time stays the same</p>
<p><strong>O(N)</strong> = as you increase the size of input, the time taken to complete operations scales linearly with that size</p>
<p><strong>O(log N) = </strong>growth curve that peaks at the beginning and slowly flattens out as the size of the data sets increase</p>
<p><strong>O(</strong><strong>N<sup>2</sup></strong><strong>) = </strong>growth will double with each additional element in the input</p>
<p><strong>Java Example for</strong> <strong>O(1):</strong></p>
<pre class="brush: java;">
    public static boolean isArrayOver100(String[] args) {
        if (args.length &#62; 100)
            return true;
        return false;
    }
</pre>
<p><strong>Java Example for O(N):</strong></p>
<pre class="brush: java;">
    public static boolean contains(String[] args, String value) {
        for (int i = 0; i &#60; args.length; i++) {
            if (args[i] == value)
                return true;
        }
        return false;
    }
</pre>
<p><strong>Java Example for O(log N):</strong></p>
<pre class="brush: java;">
public static int binarySearch(int[] toSearch, int key) {
    int fromIndex = 0;
    int toIndex = toSearch.length - 1;

    while (fromIndex &#60; toIndex) {
        int midIndex = (toIndex - fromIndex / 2) + fromIndex;
        int midValue = toSearch[midIndex];

        if (key &#62; midValue) {
            fromIndex = midIndex++;
        } else if (key &#60; midValue) {
            toIndex = midIndex - 1;
        } else {
            return midIndex;
        }
    }
    return -1;
}
</pre>
<p>See my other post on binary search <a href="http://nerdgerl.wordpress.com/2009/11/17/implementing-binary-search-in-java/">here</a>.</p>
<p><strong>Java Exmaple O(</strong><strong>N<sup>2</sup></strong><strong>)</strong></p>
<pre class="brush: java;">
public static boolean containsDuplicates(String[] args) {
        for (int i = 0; i &#60; args.length; i++) {
            for (int j = 0; j &#60; args.length; j++) {
                if (i == j)
                    break;
                if (args[i] == args[j])
                    return true;
            }
        }
        return false;
    }
</pre>
<p>I took <a href="http://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/">this</a> post as my inspiration as I found it to be a great introduction but have instead used java for the code examples.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Making the spell checker... more awesome.]]></title>
<link>http://blog.afterthedeadline.com/2009/11/17/making-the-spell-checker-more-awesome/</link>
<pubDate>Tue, 17 Nov 2009 17:36:01 +0000</pubDate>
<dc:creator>rsmudge</dc:creator>
<guid>http://blog.afterthedeadline.com/2009/11/17/making-the-spell-checker-more-awesome/</guid>
<description><![CDATA[I don&#8217;t talk much about the After the Deadline spell checker. Many people believe spell checki]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I don&#8217;t talk much about the After the Deadline spell checker. Many people believe spell checking is a solved problem and they must &#8220;work the same way&#8221;. AtD does more than spell checking, so I talk about these other things.</p>
<p>Despite the lack of talk, AtD&#8217;s spell checker is awesome and I&#8217;m constantly improving it. That&#8217;s what I&#8217;m going to write about today. This past weekend I was writing a post and I tried to spell &#8220;conoisur&#8221;. As you call tell, I don&#8217;t know how to spell it and my attempt isn&#8217;t even close. It&#8217;s bad enough that I make spell checkers and can&#8217;t spell, it&#8217;s terrible that AtD couldn&#8217;t give me any suggestions. I felt left out in the cold.</p>
<div id="attachment_279" class="wp-caption aligncenter" style="width: 225px"><a href="http://atdresearch.wordpress.com/files/2009/11/connoisseurb.jpg"><img class="size-full wp-image-279" title="connoisseurb" src="http://atdresearch.wordpress.com/files/2009/11/connoisseurb.jpg" alt="" width="215" height="106" /></a><p class="wp-caption-text">Suggestions before this post <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></div>
<p>Most spelling errors are one or two changes away from the intended word. AtD takes advantage of this and limits its suggestion search to words within two changes. By limiting the search space for words, AtD has less to choose from. This means AtD give you the right answer more often.</p>
<p>Peter Norvig conducted <a href="http://norvig.com/spell-correct.html">a quick experiment</a> where he learned that 98.9% of the errors in the <a href="http://ota.ahds.ac.uk/texts/0643.html">Birkbeck spelling error corpus</a> were within two edits and 76% were one edit away. These numbers are close to what I found in my own experiments months ago. I&#8217;d present those numbers but I&#8230; lost them. *cough*</p>
<p>From these numbers, I felt it was safe to ignore words three or more edits away from the misspelling. This works well except when I try to spell words like connoisseur or bureaucracy. For my attempts, AtD generated <strong>no</strong> suggestions.</p>
<p>Then it hit me! If there are no suggestions within two edits&#8230; why don&#8217;t I try to find words within three edits.  And if there are <em>still</em> no suggestions then, why I don&#8217;t I try words within four edits. I could go on like this forever. Unfortunately nothing is free and doing this would kill AtD&#8217;s performance. So I decided to limit my experiment to find words within three edits when no words are within two edits.</p>
<p>AtD&#8217;s spellchecker uses a neural network to score suggestions and compare them to each other. During training the neural network converges on an optimal weighting for each feature I give it. One of the features I give to the neural network is the edit distance normalized between 0.0 and 1.0. Edit distance is weighted highly as a value close to 1.0 is correct 76% of the time. I feared that introducing high edit distances that are almost always correct would create something that looks like a valley to the neural network. Meaning a high value is usually correct, a low value is usually correct, and the stuff in the middle is probably not so correct. Neural networks will make good guesses but they&#8217;re dependent on being told the story in the right way. This valley thing wasn&#8217;t going to work. So I modified the features so that an edit distance of 1 is a weight of 1.0 and everything else is 0.0.</p>
<p>Here are the numbers on AtD&#8217;s spell checker before I made these changes:</p>
<p><strong>Word Pool Accuracy</strong></p>
<table>
<tbody>
<tr>
<th>Data Set</th>
<th>Accuracy</th>
</tr>
<tr>
<td>sp_test_wpcm_nocontext.txt</td>
<td>97.80%</td>
</tr>
<tr>
<td>sp_test_aspell_nocontext.txt</td>
<td>79.06%</td>
</tr>
</tbody>
</table>
<p><strong>Spelling Corrector Accuracy</strong></p>
<table>
<tbody>
<tr>
<th>Data Set</th>
<th>Neural Network</th>
<th>Freq/Edit</th>
<th>Random</th>
</tr>
<tr>
<td>sp_test_gutenberg_context1.txt</td>
<td>93.97%</td>
<td>83.16%</td>
<td>29.71%</td>
</tr>
<tr>
<td>sp_test_gutenberg_context2.txt</td>
<td>77.14%</td>
<td>59.68%</td>
<td>19.68%</td>
</tr>
</tbody>
</table>
<p>The word pool accuracy is a measure of how often the pool of suggested words AtD generates has the intended word for a misspelled one in the test data. If the correct word is not here, AtD won&#8217;t be able to suggest it. The corrector accuracy is a measurement of how accurate AtD is at sorting the suggestion pool and putting the intended word on the top. The neural network score is what AtD uses in production and includes context. The joint frequency/edit distance score is similar to the statistical corrector in <a href="http://norvig.com/spell-correct.html">How to write a spelling corrector</a>. Without context I don&#8217;t expect most spell checkers will do much better than that.</p>
<p>Here are the numbers with the changes:</p>
<p><strong>Word Pool Accuracy</strong></p>
<table>
<tbody>
<tr>
<th>Data Set</th>
<th>Accuracy</th>
</tr>
<tr>
<td>sp_test_wpcm_nocontext.txt</td>
<td>98.19% <span style="color:green;">+0.39%</span></td>
</tr>
<tr>
<td>sp_test_aspell_nocontext.txt</td>
<td>82.58% <span style="color:green;">+3.52%</span></td>
</tr>
</tbody>
</table>
<p><strong>Spelling Corrector Accuracy</strong></p>
<table>
<tbody>
<tr>
<th>Data Set</th>
<th>Neural Network</th>
<th>Freq/Edit</th>
<th>Random</th>
</tr>
<tr>
<td>sp_test_gutenberg_context1.txt</td>
<td>94.51% <span style="color:green;">+0.54%</span></td>
<td>83.08%</td>
<td>30.18%</td>
</tr>
<tr>
<td>sp_test_gutenberg_context2.txt</td>
<td>79.38% <span style="color:green;">+2.24%</span></td>
<td>60.31%</td>
<td>23.69%</td>
</tr>
</tbody>
</table>
<h3>What this means for you</h3>
<p>These little changes let AtD expand its search for suggestions when none were found. This means better recommendations for hard to spell words without impacting AtD&#8217;s stellar correction accuracy. I hope you enjoy it.</p>
<div id="attachment_280" class="wp-caption aligncenter" style="width: 231px"><a href="http://atdresearch.wordpress.com/files/2009/11/connoisseur1.jpg"><img class="size-full wp-image-280" title="connoisseur" src="http://atdresearch.wordpress.com/files/2009/11/connoisseur1.jpg" alt="" width="221" height="209" /></a><p class="wp-caption-text">Suggestions you&#39;ll get now <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></div>
<h3>How does this compare to MS Word, ASpell, and others?</h3>
<p>If you want to compare these numbers  with other systems, I presented numbers from similar data in <a href="http://blog.afterthedeadline.com/2009/09/04/tweaking-the-atd-spellchecker/">another blog post</a>. Be sure to multiply the spelling corrector accuracy with the word pool accuracy when comparing these numbers in the ones in the other post. For example: 0.9451 * 0.9891 = 0.9348 = 93.48%</p>
<p><em>If you&#8217;d like to play around with spelling correction and neural networks, consider downloading the <a href="http://open.afterthedeadline.com">After the Deadline source code</a>. Everything you need to conduct your own experiments is included and it&#8217;s open source. The data sets used here are available in the <a href="http://open.afterthedeadline.com/download/bootstrap-data/">bootstrap data distribution</a>.<br />
</em></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Nash Equilibrium for Sparse Games: Part Deux]]></title>
<link>http://rjlipton.wordpress.com/2009/11/17/nash-equilibrium-for-sparse-games-part-deux/</link>
<pubDate>Tue, 17 Nov 2009 16:07:01 +0000</pubDate>
<dc:creator>rjlipton</dc:creator>
<guid>http://rjlipton.wordpress.com/2009/11/17/nash-equilibrium-for-sparse-games-part-deux/</guid>
<description><![CDATA[How to find approximate Nash equilibrium for sparse games Constantinos Daskalakis is one of the expe]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><font color="”#0066cc?"><br />
<em> How to find approximate Nash equilibrium for sparse games </em><br />
<font color="”#000000?"></p>
<p><a href="http://rjlipton.wordpress.com/files/2009/11/images4.jpeg"><img src="http://rjlipton.wordpress.com/files/2009/11/images4.jpeg" alt="" title="images" width="95" height="119" class="alignright size-full wp-image-3869"></a></p>
<p>
Constantinos Daskalakis is one of the experts in modern game theory, especially the structure of Nash Equilibrium for non-zero sum games. He has written a wonderful paper with Christos Papadimitriou	<a href="http://portal.acm.org/citation.cfm?id=1536414.1536427">On oblivious PTAS&#8217;s for nash equilibrium</a>. Also see his nice <a href="http://people.csail.mit.edu/costis/reconstruct.pdf">survey</a> for more information.
</p>
<p>
Today I want to talk about Costis and Christos&#8217; paper as it relates to sparse games. This is another example of the <a href="http://rjlipton.wordpress.com/2009/10/31/the-iceberg-effect-in-theory-research/">Iceberg Effect</a>: their paper has a beautiful result on game theory, but I missed another of their results.
</p>
<p><!--more--></p>
<p>
Constantinos, Costis, was kind enough to point out two things about sparse games after my earlier discussion on <a href="http://rjlipton.wordpress.com/2009/11/08/rumors-and-playing-games/">games</a>. First, that in his paper with Christos at STOC 2009, they stated a theorem that solves the sparse case of symmetric games. He went on to sketch the proof, which they did not include in their paper: I will give their proof in a moment.
</p>
<p>
Second, he points out that Shanghua Teng has observed that the uniform distribution is trivially a <img src='http://l.wordpress.com/latex.php?latex=%7B%28k%2Fn%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{(k/n)}&amp;fg=000000' title='{(k/n)}&amp;fg=000000' class='latex' />-Nash equilibrium of a <img src='http://l.wordpress.com/latex.php?latex=%7Bk%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{k}&amp;fg=000000' title='{k}&amp;fg=000000' class='latex' />-sparse game&#8212;the expected payoff from any row is at most <img src='http://l.wordpress.com/latex.php?latex=%7Bk%2Fn%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{k/n}&amp;fg=000000' title='{k/n}&amp;fg=000000' class='latex' /> for the row player and similarly for the column player.
</p>
<p>
His second point is one that I would like to discuss, since it raises an issue by what we mean to approximate a Nash Equilibrium (NE).
</p>
<p>
Let&#8217;s turn to discuss first NE and then their theorem.
</p>
</p>
<p><b> Nash Equilibrium: Exact and Approximate </b></p>
</p>
<p>
What does it mean to find an approximate NE? I think it will be easier to first explain the main issue involved by an analogy. Anyway I love analogies.
</p>
<p>
Suppose that you have a polynomial <img src='http://l.wordpress.com/latex.php?latex=%7Bf%28x%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{f(x)}&amp;fg=000000' title='{f(x)}&amp;fg=000000' class='latex' /> and want to find an <img src='http://l.wordpress.com/latex.php?latex=%7Br%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{r}&amp;fg=000000' title='{r}&amp;fg=000000' class='latex' /> so that 	</p>
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle++f%28r%29+%3D+0%2C%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle  f(r) = 0,&amp;fg=000000' title='\displaystyle  f(r) = 0,&amp;fg=000000' class='latex' /></p>
<p> of course, we call <img src='http://l.wordpress.com/latex.php?latex=%7Br%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{r}&amp;fg=000000' title='{r}&amp;fg=000000' class='latex' /> a root. Usually <img src='http://l.wordpress.com/latex.php?latex=%7Br%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{r}&amp;fg=000000' title='{r}&amp;fg=000000' class='latex' /> is not a rational number, so we cannot write it down exactly. Thus, what we do is try to find a <img src='http://l.wordpress.com/latex.php?latex=%7Bp%2Fq%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{p/q}&amp;fg=000000' title='{p/q}&amp;fg=000000' class='latex' /> so that
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle++%26%23124%3Bf%28p%2Fq%29%26%23124%3B+%5Cle+%5Cepsilon+%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle  &#124;f(p/q)&#124; \le \epsilon &amp;fg=000000' title='\displaystyle  &#124;f(p/q)&#124; \le \epsilon &amp;fg=000000' class='latex' /></p>
<p> where <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%26%2362%3B0%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon&gt;0}&amp;fg=000000' title='{\epsilon&gt;0}&amp;fg=000000' class='latex' /> is the required precision and <img src='http://l.wordpress.com/latex.php?latex=%7Bp%2Cq%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{p,q}&amp;fg=000000' title='{p,q}&amp;fg=000000' class='latex' /> are integers. </p>
<p>
There is a fundamental problem: simply because <img src='http://l.wordpress.com/latex.php?latex=%7Bf%28p%2Fq%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{f(p/q)}&amp;fg=000000' title='{f(p/q)}&amp;fg=000000' class='latex' /> is small does that mean that it is near an actual root of <img src='http://l.wordpress.com/latex.php?latex=%7Bf%28x%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{f(x)}&amp;fg=000000' title='{f(x)}&amp;fg=000000' class='latex' />? It does not, in general. What we want are the stronger statements: </p>
<ol>
<li> The value of <img src='http://l.wordpress.com/latex.php?latex=%7Bf%28p%2Fq%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{f(p/q)}&amp;fg=000000' title='{f(p/q)}&amp;fg=000000' class='latex' /> is near <img src='http://l.wordpress.com/latex.php?latex=%7B0%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{0}&amp;fg=000000' title='{0}&amp;fg=000000' class='latex' />; </li>
<li> There is a <img src='http://l.wordpress.com/latex.php?latex=%7Bb%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{b}&amp;fg=000000' title='{b}&amp;fg=000000' class='latex' /> so that <img src='http://l.wordpress.com/latex.php?latex=%7Bf%28b%29%3D0%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{f(b)=0}&amp;fg=000000' title='{f(b)=0}&amp;fg=000000' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%7B%26%23124%3Bb-p%2Fq%26%23124%3B%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{&#124;b-p/q&#124;}&amp;fg=000000' title='{&#124;b-p/q&#124;}&amp;fg=000000' class='latex' /> is also small.
</li>
</ol>
<p> In this case we can say that <img src='http://l.wordpress.com/latex.php?latex=%7Bp%2Fq%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{p/q}&amp;fg=000000' title='{p/q}&amp;fg=000000' class='latex' /> is an <i>approximate root</i> of the polynomial. If there is no such <img src='http://l.wordpress.com/latex.php?latex=%7Bb%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{b}&amp;fg=000000' title='{b}&amp;fg=000000' class='latex' />, then <img src='http://l.wordpress.com/latex.php?latex=%7Bp%2Fq%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{p/q}&amp;fg=000000' title='{p/q}&amp;fg=000000' class='latex' /> is an interesting point, but it is not correct to call it an approximate zero. </p>
<p>
This behavior is analogous to what happens with &#8220;approximate NE&#8217;s.&#8221; There are two types of interpretations of what an approximate NE is:  </p>
<li>An <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-near NE:  This is a pair of strategies that are within an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' /> of an <i>exact</i> NE. </li>
<li>An <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-NE:  This is a pair of strategies such that a player who defects from their strategy can gain at most an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />.
<p>
Costis, in his survey, points out that the first notion is reasonable, but the latter is the one that we usually use:  Note also that it is easy for a player to check the approximate optimality of the actions used by her mixed strategy. So the notion of an approximate Nash equilibrium is much more appealing <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cdots%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\dots}&amp;fg=000000' title='{\dots}&amp;fg=000000' class='latex' /> and, in fact, this is the notion most commonly used.
</p>
<p>
Note, the analogy to the root problem: in the first we are near a root, and in the second we are at a small value. As Costis points out the latter can be checked easily, while checking that a point is near an exact root is not as easy.
</p>
</p>
<p><b> Sparse Games </b></p>
</p>
<p>
I will now state their theorem:
</p>
</p>
<blockquote><p><b>Theorem: </b> <em> Suppose that <img src='http://l.wordpress.com/latex.php?latex=%7BA%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{A}&amp;bg=e8e8e8&amp;fg=000000' title='{A}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> is an <img src='http://l.wordpress.com/latex.php?latex=%7Bn+%5Ctimes+n%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{n \times n}&amp;bg=e8e8e8&amp;fg=000000' title='{n \times n}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> matrix with entries in <img src='http://l.wordpress.com/latex.php?latex=%7B%5C%7B0%2C1%5C%7D%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\{0,1\}}&amp;bg=e8e8e8&amp;fg=000000' title='{\{0,1\}}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />, such that each row and column in <img src='http://l.wordpress.com/latex.php?latex=%7BA%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{A}&amp;bg=e8e8e8&amp;fg=000000' title='{A}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> has at most <img src='http://l.wordpress.com/latex.php?latex=%7Bk%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{k}&amp;bg=e8e8e8&amp;fg=000000' title='{k}&amp;bg=e8e8e8&amp;fg=000000' class='latex' /> <img src='http://l.wordpress.com/latex.php?latex=%7B1%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{1}&amp;bg=e8e8e8&amp;fg=000000' title='{1}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />&#8217;s. Then, for the symmetric game defined by <img src='http://l.wordpress.com/latex.php?latex=%7BA%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{A}&amp;bg=e8e8e8&amp;fg=000000' title='{A}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />, we can find an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;bg=e8e8e8&amp;fg=000000' title='{\epsilon}&amp;bg=e8e8e8&amp;fg=000000' class='latex' />-NE in time bounded by
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle++n%5E%7B2k%2F%5Cepsilon+%2B+O%281%29%7D.+%26%2338%3Bbg%3De8e8e8%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle  n^{2k/\epsilon + O(1)}. &amp;bg=e8e8e8&amp;fg=000000' title='\displaystyle  n^{2k/\epsilon + O(1)}. &amp;bg=e8e8e8&amp;fg=000000' class='latex' /></p>
<p> </em></p></blockquote>
<p>
Here is a sketch of their proof:
</p>
<p>
<em>Proof:</em>
</p>
<p>
The key insight is that it is enough to consider strategies for the row and column player where the probabilities are integer multiples of <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cdelta+%3D+%5Cepsilon%2F2k%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\delta = \epsilon/2k}&amp;fg=000000' title='{\delta = \epsilon/2k}&amp;fg=000000' class='latex' />. The number of such strategies for either player is at most 	</p>
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle++n%5E%7B1%2F%5Cdelta%7D.+%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle  n^{1/\delta}. &amp;fg=000000' title='\displaystyle  n^{1/\delta}. &amp;fg=000000' class='latex' /></p>
<p> This follows since the number of strategies are bounded by the number of ways to place <img src='http://l.wordpress.com/latex.php?latex=%7B1%2F%5Cdelta%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{1/\delta}&amp;fg=000000' title='{1/\delta}&amp;fg=000000' class='latex' /> objects into <img src='http://l.wordpress.com/latex.php?latex=%7Bn%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{n}&amp;fg=000000' title='{n}&amp;fg=000000' class='latex' /> &#8220;bins.&#8221;</p>
<p>
We now have a &#8220;small&#8221; set of strategies, the following argument will show that one of these strategies contains a pair that is an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-near NE. 	 Consider an exact NE say <img src='http://l.wordpress.com/latex.php?latex=%7B%28x%2Cy%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{(x,y)}&amp;fg=000000' title='{(x,y)}&amp;fg=000000' class='latex' />. Notice that there exist strategies <img src='http://l.wordpress.com/latex.php?latex=%7B%28x%27%2Cy%27%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{(x&#039;,y&#039;)}&amp;fg=000000' title='{(x&#039;,y&#039;)}&amp;fg=000000' class='latex' /> such that the following are satisfied: </p>
<ol>
<li> For all <img src='http://l.wordpress.com/latex.php?latex=%7Bi%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{i}&amp;fg=000000' title='{i}&amp;fg=000000' class='latex' />: <img src='http://l.wordpress.com/latex.php?latex=%7B%26%23124%3B+x%27_%7Bi%7D+-+x_%7Bi%7D+%26%23124%3B+%5Cle+%5Cdelta%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{&#124; x&#039;_{i} - x_{i} &#124; \le \delta}&amp;fg=000000' title='{&#124; x&#039;_{i} - x_{i} &#124; \le \delta}&amp;fg=000000' class='latex' /> and <img src='http://l.wordpress.com/latex.php?latex=%7B%26%23124%3B+y%27_%7Bi%7D+-+y_%7Bi%7D+%26%23124%3B+%5Cle+%5Cdelta%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{&#124; y&#039;_{i} - y_{i} &#124; \le \delta}&amp;fg=000000' title='{&#124; y&#039;_{i} - y_{i} &#124; \le \delta}&amp;fg=000000' class='latex' />. </li>
<li> For all <img src='http://l.wordpress.com/latex.php?latex=%7Bi%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{i}&amp;fg=000000' title='{i}&amp;fg=000000' class='latex' />: if <img src='http://l.wordpress.com/latex.php?latex=%7Bx_%7Bi%7D+%3D0%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x_{i} =0}&amp;fg=000000' title='{x_{i} =0}&amp;fg=000000' class='latex' /> then <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27_%7Bi%7D+%3D0%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;_{i} =0}&amp;fg=000000' title='{x&#039;_{i} =0}&amp;fg=000000' class='latex' />, and if <img src='http://l.wordpress.com/latex.php?latex=%7By_%7Bi%7D%3D0%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{y_{i}=0}&amp;fg=000000' title='{y_{i}=0}&amp;fg=000000' class='latex' /> then <img src='http://l.wordpress.com/latex.php?latex=%7By%27_%7Bi%7D%3D0%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{y&#039;_{i}=0}&amp;fg=000000' title='{y&#039;_{i}=0}&amp;fg=000000' class='latex' />.
</li>
</ol>
<p>
Consider <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;}&amp;fg=000000' title='{x&#039;}&amp;fg=000000' class='latex' />. If <img src='http://l.wordpress.com/latex.php?latex=%7Bx_%7Bi%7D%3D0%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x_{i}=0}&amp;fg=000000' title='{x_{i}=0}&amp;fg=000000' class='latex' />, then set <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27_%7Bi%7D%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;_{i}}&amp;fg=000000' title='{x&#039;_{i}}&amp;fg=000000' class='latex' /> to <img src='http://l.wordpress.com/latex.php?latex=%7B0%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{0}&amp;fg=000000' title='{0}&amp;fg=000000' class='latex' />. Otherwise, set <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27_%7Bi%7D%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;_{i}}&amp;fg=000000' title='{x&#039;_{i}}&amp;fg=000000' class='latex' /> to the nearest multiple of <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cdelta%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\delta}&amp;fg=000000' title='{\delta}&amp;fg=000000' class='latex' />. This almost works: the small issue is that if <img src='http://l.wordpress.com/latex.php?latex=%7Bx_%7Bi%7D%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x_{i}}&amp;fg=000000' title='{x_{i}}&amp;fg=000000' class='latex' /> is not a exact multiple of <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cdelta%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\delta}&amp;fg=000000' title='{\delta}&amp;fg=000000' class='latex' />, then do we round up or down? Either rule will make <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;}&amp;fg=000000' title='{x&#039;}&amp;fg=000000' class='latex' /> satisfy the needed conditions above. However, we also need <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;}&amp;fg=000000' title='{x&#039;}&amp;fg=000000' class='latex' /> to be a probability vector: it is easy to see that by rounding some up or down we can adjust <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;}&amp;fg=000000' title='{x&#039;}&amp;fg=000000' class='latex' /> to satisfy 	</p>
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+%5Csum_%7Bi%7Dx%27_%7Bi%7D+%3D+1%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle \sum_{i}x&#039;_{i} = 1&amp;fg=000000' title='\displaystyle \sum_{i}x&#039;_{i} = 1&amp;fg=000000' class='latex' /></p>
<p> which will make it a probability vector. The same method works for <img src='http://l.wordpress.com/latex.php?latex=%7By%27%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{y&#039;}&amp;fg=000000' title='{y&#039;}&amp;fg=000000' class='latex' />. 	 Now we need to prove that this strategy pair is an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-near NE. The payoff for the row player is <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27Ay%27%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;Ay&#039;}&amp;fg=000000' title='{x&#039;Ay&#039;}&amp;fg=000000' class='latex' /> and for the column player is <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27A%5E%7BT%7Dy%27%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;A^{T}y&#039;}&amp;fg=000000' title='{x&#039;A^{T}y&#039;}&amp;fg=000000' class='latex' />. Let <img src='http://l.wordpress.com/latex.php?latex=%7Be_i%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{e_i}&amp;fg=000000' title='{e_i}&amp;fg=000000' class='latex' /> denote a unit vector with <img src='http://l.wordpress.com/latex.php?latex=%7B1%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{1}&amp;fg=000000' title='{1}&amp;fg=000000' class='latex' /> at <img src='http://l.wordpress.com/latex.php?latex=%7Bi%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{i}&amp;fg=000000' title='{i}&amp;fg=000000' class='latex' />-th coordinate. For notational convenience, we omit the transform symbols on the vectors. The usage should be clear from the context.</p>
<p>
Notice that the pair of strategies <img src='http://l.wordpress.com/latex.php?latex=%7Bx%27%2C+y%27%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x&#039;, y&#039;}&amp;fg=000000' title='{x&#039;, y&#039;}&amp;fg=000000' class='latex' /> and the NE <img src='http://l.wordpress.com/latex.php?latex=%7Bx%2Cy%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{x,y}&amp;fg=000000' title='{x,y}&amp;fg=000000' class='latex' /> satisfy: </p>
<ol>
<li> <img src='http://l.wordpress.com/latex.php?latex=%7B%26%23124%3B+e_i+A+y%27+-+e_i+A+y%26%23124%3B+%5Cle+%5Cepsilon%2F2%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{&#124; e_i A y&#039; - e_i A y&#124; \le \epsilon/2}&amp;fg=000000' title='{&#124; e_i A y&#039; - e_i A y&#124; \le \epsilon/2}&amp;fg=000000' class='latex' />, for all <img src='http://l.wordpress.com/latex.php?latex=%7Bi%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{i}&amp;fg=000000' title='{i}&amp;fg=000000' class='latex' />. </li>
<li> <img src='http://l.wordpress.com/latex.php?latex=%7B%26%23124%3B+x%27+A%5E%7BT%7D+e_j+-+x+A%5E%7BT%7D+e_j%26%23124%3B+%5Cle+%5Cepsilon%2F2%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{&#124; x&#039; A^{T} e_j - x A^{T} e_j&#124; \le \epsilon/2}&amp;fg=000000' title='{&#124; x&#039; A^{T} e_j - x A^{T} e_j&#124; \le \epsilon/2}&amp;fg=000000' class='latex' />, for all <img src='http://l.wordpress.com/latex.php?latex=%7Bj%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{j}&amp;fg=000000' title='{j}&amp;fg=000000' class='latex' />.
</li>
</ol>
<p>
The first claim follows from the fact that 	</p>
<p align="center"><img src='http://l.wordpress.com/latex.php?latex=%5Cdisplaystyle+%5Csum_%7Bj%3D1%7D%5E%7Bn%7D%7B%26%23124%3B%28A+y%27%29_j+-+%28A+y%29_j%26%23124%3B%7D+%5Cle+k%5Cdelta+%3D+k%5Ccdot+%28%5Cepsilon%2F2k%29+%3D+%5Cepsilon%2F2.%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\displaystyle \sum_{j=1}^{n}{&#124;(A y&#039;)_j - (A y)_j&#124;} \le k\delta = k\cdot (\epsilon/2k) = \epsilon/2.&amp;fg=000000' title='\displaystyle \sum_{j=1}^{n}{&#124;(A y&#039;)_j - (A y)_j&#124;} \le k\delta = k\cdot (\epsilon/2k) = \epsilon/2.&amp;fg=000000' class='latex' /></p>
<p> The second claim is analogous. This is where we use that <img src='http://l.wordpress.com/latex.php?latex=%7BA%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{A}&amp;fg=000000' title='{A}&amp;fg=000000' class='latex' /> has at most <img src='http://l.wordpress.com/latex.php?latex=%7Bk%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{k}&amp;fg=000000' title='{k}&amp;fg=000000' class='latex' /> <img src='http://l.wordpress.com/latex.php?latex=%7B1%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{1}&amp;fg=000000' title='{1}&amp;fg=000000' class='latex' />&#8217;s in each row/column. Therefore, the total error from the NE <img src='http://l.wordpress.com/latex.php?latex=%7B%28x%2Cy%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{(x,y)}&amp;fg=000000' title='{(x,y)}&amp;fg=000000' class='latex' /> is at most <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%2F2+%2B+%5Cepsilon%2F2+%3D+%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon/2 + \epsilon/2 = \epsilon}&amp;fg=000000' title='{\epsilon/2 + \epsilon/2 = \epsilon}&amp;fg=000000' class='latex' /></p>
<p>
It follows from the above that <img src='http://l.wordpress.com/latex.php?latex=%7B%28x%27%2C+y%27%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{(x&#039;, y&#039;)}&amp;fg=000000' title='{(x&#039;, y&#039;)}&amp;fg=000000' class='latex' /> is an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-near NE of the game. <img src='http://l.wordpress.com/latex.php?latex=%5CBox%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\Box&amp;fg=000000' title='\Box&amp;fg=000000' class='latex' /></p>
<p>
The above proof shows the <i>existence</i> of an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-near NE <img src='http://l.wordpress.com/latex.php?latex=%7B%28x%27%2Cy%27%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{(x&#039;,y&#039;)}&amp;fg=000000' title='{(x&#039;,y&#039;)}&amp;fg=000000' class='latex' /> in the search space formed by the strategies that are multiples of <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cdelta%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\delta}&amp;fg=000000' title='{\delta}&amp;fg=000000' class='latex' />. This strategy pair is near the exact NE <img src='http://l.wordpress.com/latex.php?latex=%7B%28x%2Cy%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{(x,y)}&amp;fg=000000' title='{(x,y)}&amp;fg=000000' class='latex' />. However, because of the difficulty of searching for an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-near NE, an exhaustive search in this space can only guarantee that we would find an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-NE, and not an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-near NE.
</p>
</p>
<p><b> Open Problems </b></p>
</p>
<p>
An interesting open problem is to try to found an <img src='http://l.wordpress.com/latex.php?latex=%7B%5Cepsilon%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{\epsilon}&amp;fg=000000' title='{\epsilon}&amp;fg=000000' class='latex' />-near NE. The above proof shows that it is in a relatively &#8220;small&#8221; list of strategies. Is it possible to discriminate and determine which are near exact NE&#8217;s?
</p>
<p>
The above proof gives us a PTAS for games with a bounded number of 1&#8217;s in each row and column. However, for matrices with <img src='http://l.wordpress.com/latex.php?latex=%7BO%28n%29%7D%26%2338%3Bfg%3D000000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='{O(n)}&amp;fg=000000' title='{O(n)}&amp;fg=000000' class='latex' /> 1&#8217;s in all, the problem of finding a PTAS is still, I believe, open.
</p>
</li>
<p></font></font></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Implementing Binary Search in Java]]></title>
<link>http://nerdgerl.wordpress.com/2009/11/17/implementing-binary-search-in-java/</link>
<pubDate>Tue, 17 Nov 2009 00:56:56 +0000</pubDate>
<dc:creator>nerdgerl</dc:creator>
<guid>http://nerdgerl.wordpress.com/2009/11/17/implementing-binary-search-in-java/</guid>
<description><![CDATA[What is it? Binary Search is a technique used to search sorted data sets. It works by comparing the ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><h3>What is it?</h3>
<p><a href="http://en.wikipedia.org/wiki/Binary_search">Binary Search</a> is a technique used to search <strong>sorted data sets</strong>. It works by comparing the middle element against the search value, if the search value is greater than the middle element a subset is created out of the upper half of the set. The same operation is then performed on the subset recursively until the value is either found and the index returned, or not found and -1 returned.</p>
<p>eg. If we start with with a set of ints: [1, 4, 6, 8, 9, 10, 11, 13, 15] and our search value = 11</p>
<ul>
<li> Choose the middle element: 9</li>
<li>Is 9 &#62; 11</li>
<li>No, so take the upper half and create a subset [10, 11, 13, 15]</li>
<li>Choose the middle element: 13 (4/2 =2 which is the third element in the array as arrays are zero based)</li>
<li>Is 13 &#62; 11</li>
<li>No, so take the lower half and create a subset [10, 11]</li>
<li>Choose the middle element: 11</li>
<li>Is 11 &#62;= 11 yes &#8211; we have found our element</li>
</ul>
<h3>Binary Search in Java</h3>
<p>I have created my own java binary search method:</p>
<pre class="brush: java;">
    public static int binarySearch(int[] toSearch, int key) {
        int fromIndex = 0;
        int toIndex = toSearch.length - 1;

        while (fromIndex &#60; toIndex) {
            int midIndex = (toIndex - fromIndex / 2) + fromIndex;
            int midValue = toSearch[midIndex];

            if (key &#62; midValue) {
                fromIndex = midIndex++;
            } else if (key &#60; midValue) {
                toIndex = midIndex - 1;
            } else {
                return midIndex;
            }
        }
        return -1;
    }
</pre>
<p>Take a look at <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html#binarySearch(int[],%20int)">Arrays.binarySearch()</a> method to see the java source code implementation of the search. If you don&#8217;t have the java source code attached to your favourite IDE I suggest you do so, it&#8217;s a great way to learn how everything works.</p>
<h3>Complexity</h3>
<p>The complexity of the binary search is<strong> O(log n)</strong>.</p>
<h3>Why use Binary Search?</h3>
<p>Binary Search is quicker than searching through every element (O(n)) as it halves the amount of elements to search each iteration. This halving means that after a strong growth curve at the beginning, it slowly flattens out as the size of the input data set increases, therefore it is <strong>good for large data sets</strong>.</p>
<h3>More Info</h3>
<p>There is a good introductory explanation of binary search and O notation <a href="http://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/">here</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[GENERATE #2]]></title>
<link>http://fastforeword.wordpress.com/2009/11/16/generate-2/</link>
<pubDate>Mon, 16 Nov 2009 03:39:28 +0000</pubDate>
<dc:creator>rvzkm</dc:creator>
<guid>http://fastforeword.wordpress.com/2009/11/16/generate-2/</guid>
<description><![CDATA[&nbsp; i leave you one photo that exemplifies the materialisation of will, belief and proactivity: t]]></description>
<content:encoded><![CDATA[&nbsp; i leave you one photo that exemplifies the materialisation of will, belief and proactivity: t]]></content:encoded>
</item>

</channel>
</rss>
