<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Algorithms In Real Life</title>
	<atom:link href="http://lbrandy.com/blog/2008/10/algorithms-in-real-life/feed/" rel="self" type="application/rss+xml" />
	<link>http://lbrandy.com/blog/2008/10/algorithms-in-real-life/</link>
	<description>{ on programming and the internets, every monday }</description>
	<lastBuildDate>Fri, 12 Mar 2010 03:29:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Christopher Elwell</title>
		<link>http://lbrandy.com/blog/2008/10/algorithms-in-real-life/comment-page-1/#comment-570</link>
		<dc:creator>Christopher Elwell</dc:creator>
		<pubDate>Tue, 04 Nov 2008 04:41:54 +0000</pubDate>
		<guid isPermaLink="false">http://lbrandy.com/blog/?p=196#comment-570</guid>
		<description>I like thinking in this way.  And seeing the world around me, thinking about the molecules and atoms as a particle simulation, it is wonderful.  God created it all.  And beautifully.</description>
		<content:encoded><![CDATA[<p>I like thinking in this way.  And seeing the world around me, thinking about the molecules and atoms as a particle simulation, it is wonderful.  God created it all.  And beautifully.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://lbrandy.com/blog/2008/10/algorithms-in-real-life/comment-page-1/#comment-512</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Thu, 30 Oct 2008 17:37:27 +0000</pubDate>
		<guid isPermaLink="false">http://lbrandy.com/blog/?p=196#comment-512</guid>
		<description>Concerning the paper sorting, teachers (and people in general) go for less &quot;optimal&quot; sorting algorithms to avoid permutations. Quick sort is nice in programming, but requires permuting many times. Try to do that with a stack of paper, and you&#039;ll find you want to spend a bit more time on comparison than permutation.</description>
		<content:encoded><![CDATA[<p>Concerning the paper sorting, teachers (and people in general) go for less &#8220;optimal&#8221; sorting algorithms to avoid permutations. Quick sort is nice in programming, but requires permuting many times. Try to do that with a stack of paper, and you&#8217;ll find you want to spend a bit more time on comparison than permutation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grover Cleveland</title>
		<link>http://lbrandy.com/blog/2008/10/algorithms-in-real-life/comment-page-1/#comment-361</link>
		<dc:creator>Grover Cleveland</dc:creator>
		<pubDate>Fri, 24 Oct 2008 23:04:23 +0000</pubDate>
		<guid isPermaLink="false">http://lbrandy.com/blog/?p=196#comment-361</guid>
		<description>I do not believe in buckets. Nor sorting. Nor any combination of the two.
I believe in Bourbon Democrats.</description>
		<content:encoded><![CDATA[<p>I do not believe in buckets. Nor sorting. Nor any combination of the two.<br />
I believe in Bourbon Democrats.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinh</title>
		<link>http://lbrandy.com/blog/2008/10/algorithms-in-real-life/comment-page-1/#comment-352</link>
		<dc:creator>Vinh</dc:creator>
		<pubDate>Thu, 23 Oct 2008 06:28:56 +0000</pubDate>
		<guid isPermaLink="false">http://lbrandy.com/blog/?p=196#comment-352</guid>
		<description>$myclass[&#039;doug&#039;] = 3;
$myclass[&#039;johnny&#039;] = 23;
$myclass[&#039;joanne&#039;] = 22;
$myclass[&#039;zach&#039;] = 30;
$myclass[&#039;abe&#039;] = 1;


foreach($papers as $paper)
 $sorted_papers[$myclass[$paper-&gt;name]] = $paper;

It all simply boils down to that ya?
 that&#039;s Linear paper arranging in my book....</description>
		<content:encoded><![CDATA[<p>$myclass['doug'] = 3;<br />
$myclass['johnny'] = 23;<br />
$myclass['joanne'] = 22;<br />
$myclass['zach'] = 30;<br />
$myclass['abe'] = 1;</p>
<p>foreach($papers as $paper)<br />
 $sorted_papers[$myclass[$paper-&gt;name]] = $paper;</p>
<p>It all simply boils down to that ya?<br />
 that&#8217;s Linear paper arranging in my book&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: louis</title>
		<link>http://lbrandy.com/blog/2008/10/algorithms-in-real-life/comment-page-1/#comment-343</link>
		<dc:creator>louis</dc:creator>
		<pubDate>Tue, 21 Oct 2008 13:05:13 +0000</pubDate>
		<guid isPermaLink="false">http://lbrandy.com/blog/?p=196#comment-343</guid>
		<description>@Joe,

You don&#039;t need to have &quot;fixed&quot; width buckets to have constant time look up. But I concede that in general you are correct when you say that completely arbitrary bucket widths is rarely a constant time look up (barring the creation of some prohibitively large look up table). 

As for your second comment, I&#039;d encourage you try to a bucket sort versus a quick sort on 30 papers (or a deck of cards). You&#039;ll find the bucket sort is substantially better :P

To your more important point, though, that as the data set get larger, a &quot;naive&quot; bucket sort becomes problematic. This is true. If you mildly alter the bucket sort into the iterative variety, like a postal sort or radix sort, it will still outperform quicksort for large N.</description>
		<content:encoded><![CDATA[<p>@Joe,</p>
<p>You don&#8217;t need to have &#8220;fixed&#8221; width buckets to have constant time look up. But I concede that in general you are correct when you say that completely arbitrary bucket widths is rarely a constant time look up (barring the creation of some prohibitively large look up table). </p>
<p>As for your second comment, I&#8217;d encourage you try to a bucket sort versus a quick sort on 30 papers (or a deck of cards). You&#8217;ll find the bucket sort is substantially better <img src='http://lbrandy.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>To your more important point, though, that as the data set get larger, a &#8220;naive&#8221; bucket sort becomes problematic. This is true. If you mildly alter the bucket sort into the iterative variety, like a postal sort or radix sort, it will still outperform quicksort for large N.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://lbrandy.com/blog/2008/10/algorithms-in-real-life/comment-page-1/#comment-332</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 21 Oct 2008 08:50:11 +0000</pubDate>
		<guid isPermaLink="false">http://lbrandy.com/blog/?p=196#comment-332</guid>
		<description>My teachers always collected papers in alphabetical order, usually by seating students in alphabetical order.</description>
		<content:encoded><![CDATA[<p>My teachers always collected papers in alphabetical order, usually by seating students in alphabetical order.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe</title>
		<link>http://lbrandy.com/blog/2008/10/algorithms-in-real-life/comment-page-1/#comment-331</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Tue, 21 Oct 2008 04:50:18 +0000</pubDate>
		<guid isPermaLink="false">http://lbrandy.com/blog/?p=196#comment-331</guid>
		<description>@louis

In your original example the teacher was sorting names. When you argue O(1) bucket lookup you use integers and you specifically switch to evenly distributed integers because that normalizes both the range of values for the bucket (bucket width) and the number of entries in the bucket (bucket depth). That doesn&#039;t match with the task you are comparing to.

You can either have uneven &quot;bucket width&quot; to keep the bucket size under control at the cost of log(n) bucket lookup (not to mention n*log(n) to gather the data to size the buckets), or you can have fixed &quot;bucket width&quot; (constant lookup time) at the cost of paying an n^2 sort for clustered buckets of n elements. The problem is that the penalty for clustered buckets grows very quickly (average of the square of the element count) and it must stay under log(n) which is a very slow growing function.

You&#039;re trying to show that bucket sort, with insertion sorted buckets, will beat the n*log2(n) performance of quicksort quite handily for sets like names. I don&#039;t think it is going to work. In a class of 30 students, it&#039;s about a wash. Things get much worse the larger the set is.</description>
		<content:encoded><![CDATA[<p>@louis</p>
<p>In your original example the teacher was sorting names. When you argue O(1) bucket lookup you use integers and you specifically switch to evenly distributed integers because that normalizes both the range of values for the bucket (bucket width) and the number of entries in the bucket (bucket depth). That doesn&#8217;t match with the task you are comparing to.</p>
<p>You can either have uneven &#8220;bucket width&#8221; to keep the bucket size under control at the cost of log(n) bucket lookup (not to mention n*log(n) to gather the data to size the buckets), or you can have fixed &#8220;bucket width&#8221; (constant lookup time) at the cost of paying an n^2 sort for clustered buckets of n elements. The problem is that the penalty for clustered buckets grows very quickly (average of the square of the element count) and it must stay under log(n) which is a very slow growing function.</p>
<p>You&#8217;re trying to show that bucket sort, with insertion sorted buckets, will beat the n*log2(n) performance of quicksort quite handily for sets like names. I don&#8217;t think it is going to work. In a class of 30 students, it&#8217;s about a wash. Things get much worse the larger the set is.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
