<?xml version="1.0" encoding="utf-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Intrepid Blog &#187; line sort</title>
	<atom:link href="http://blog.affien.com/archives/tag/line-sort/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.affien.com</link>
	<description>A few thoughts</description>
	<lastBuildDate>Mon, 23 Jan 2012 08:47:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Code Golf 2: Line Sort</title>
		<link>http://blog.affien.com/archives/2005/11/01/code-golf-2-line-sort/</link>
		<comments>http://blog.affien.com/archives/2005/11/01/code-golf-2-line-sort/#comments</comments>
		<pubDate>Tue, 01 Nov 2005 20:44:04 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Code Golf]]></category>
		<category><![CDATA[line sort]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2005/11/01/code-golf-2-line-sort/</guid>
		<description><![CDATA[Code Golf. As with the real sport the goal is to reduce [...]]]></description>
			<content:encoded><![CDATA[<p>Code Golf. As with the real sport the goal is to reduce the number of strokes that it takes to complete a particular objective, although with Code Golf “strokes” refers to keystrokes rather than swings of a golf club.</p>
<p><strong>Create an algorithm that reads lines from the <em>stdin</em> until it hits an <em>EOF</em> and prints those lines sorted to the <em>stdout</em></strong></p>
<ul>
<li>Don&#8217;t use the language&#8217;s native sorting capabilities, write your own sorting algorithm. (<code>print for sort<></code> would be too easy.)</li>
<li>Any language is allowed, except for those that myseriously implement a 1 byte command that does exactly this.</li>
</ul>
<p>Example implementation using inverted bubble sort:</p>
<pre>@a = &lt;&gt;;
for ($i = 0; $i &lt;= $#a; $i++) {
 for ($j = $i; $j &lt;= $#a; $j++) {
  if (@a[$i] ge @a[$j]) {
   $t = @a[$j];
   @a[$j] = @a[$i];
   @a[$i] = $t;
  }
 }
}
foreach(@a) {
 print;
}</pre>
<p>This implementation is very large and inefficient, and just an example.</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2005/11/01/code-golf-2-line-sort/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

