<?xml version="1.0" encoding="utf-8"?>
<!-- If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/ -->
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:lj="http://www.livejournal.com">
  <id>urn:lj:livejournal.com:atom1:zunger</id>
  <title>Yonatan Zunger</title>
  <subtitle>Yonatan Zunger</subtitle>
  <author>
    <name>Yonatan Zunger</name>
  </author>
  <link rel="alternate" type="text/html" href="http://zunger.livejournal.com/"/>
  <link rel="self" type="text/xml" href="http://zunger.livejournal.com/data/atom"/>
  <updated>2010-04-30T18:21:42Z</updated>
  <lj:journal userid="567575" username="zunger" type="personal"/>
  <link rel="service.feed" type="application/x.atom+xml" href="http://zunger.livejournal.com/data/atom" title="Yonatan Zunger"/>
  <entry>
    <id>urn:lj:livejournal.com:atom1:zunger:168060</id>
    <link rel="alternate" type="text/html" href="http://zunger.livejournal.com/168060.html"/>
    <link rel="self" type="text/xml" href="http://zunger.livejournal.com/data/atom/?itemid=168060"/>
    <title>zunger @ 2010-04-30T10:39:00</title>
    <published>2010-04-30T17:39:39Z</published>
    <updated>2010-04-30T18:21:42Z</updated>
    <content type="html">So a few days ago, I got an amusing idea for an interview question which I realized was totally pointless as an interview question, because it has no practical value whatsoever. So instead, I'm going to post it on my blog, as a way to help waste the time of all my CS friends. There is no prize whatsoever for a correct answer, except for the satisfaction of having &lt;s&gt;avoided work for a while&lt;/s&gt; solved an amusing problem.&lt;br /&gt;&lt;br /&gt;Here are two really bad ways to sort an array:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Random sort: Repeatedly select a random permutation and apply it to the set. Stop when it becomes sorted.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Brute-force sort: Iterate over the set of all permutations of N elements. Apply each in turn. If the list is now sorted, stop.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;The question is: which of the two is less efficient, and (the trickier part) by how much?&lt;br /&gt;&lt;br /&gt;(Clarification: For the latter, "how much" in terms of average [mean] time to sort. You can also average over a large number of possible inputs)</content>
  </entry>
</feed>
