<?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: Friday Algorithms: JavaScript Bubble Sort</title>
	<atom:link href="/2010/07/09/friday-algorithms-javascript-bubble-sort/feed/" rel="self" type="application/rss+xml" />
	<link>/2010/07/09/friday-algorithms-javascript-bubble-sort/</link>
	<description>on web development</description>
	<lastBuildDate>Fri, 26 Oct 2018 21:40:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>By: Anaet Hossain Rezve</title>
		<link>/2010/07/09/friday-algorithms-javascript-bubble-sort/comment-page-1/#comment-417015</link>
		<dc:creator><![CDATA[Anaet Hossain Rezve]]></dc:creator>
		<pubDate>Wed, 17 Aug 2016 01:57:19 +0000</pubDate>
		<guid isPermaLink="false">/?p=1780#comment-417015</guid>
		<description><![CDATA[var arr = [1, 6, 9, 2, 10, 34, 66, 3];

for(var i = 0; i &#060; arr.length - 1; j++) {
  for(var j = 1; j  arr[j]) {
      var t = arr[j];
      arr[j] = arr[j - 1];
      arr[j - 1] = t;
    }
  }
}

console.log(arr);]]></description>
		<content:encoded><![CDATA[<p>var arr = [1, 6, 9, 2, 10, 34, 66, 3];</p>
<p>for(var i = 0; i &lt; arr.length &#8211; 1; j++) {<br />
  for(var j = 1; j  arr[j]) {<br />
      var t = arr[j];<br />
      arr[j] = arr[j &#8211; 1];<br />
      arr[j &#8211; 1] = t;<br />
    }<br />
  }<br />
}</p>
<p>console.log(arr);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>/2010/07/09/friday-algorithms-javascript-bubble-sort/comment-page-1/#comment-404381</link>
		<dc:creator><![CDATA[Tony]]></dc:creator>
		<pubDate>Tue, 12 Apr 2016 04:32:50 +0000</pubDate>
		<guid isPermaLink="false">/?p=1780#comment-404381</guid>
		<description><![CDATA[var numbers = [7,623,53,1,582,928];

function bubbleSort() {
    numbers.sort(function(a, b){return a-b});
    console.log(numbers);
}
    
bubbleSort();]]></description>
		<content:encoded><![CDATA[<p>var numbers = [7,623,53,1,582,928];</p>
<p>function bubbleSort() {<br />
    numbers.sort(function(a, b){return a-b});<br />
    console.log(numbers);<br />
}</p>
<p>bubbleSort();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nz_hmz</title>
		<link>/2010/07/09/friday-algorithms-javascript-bubble-sort/comment-page-1/#comment-379500</link>
		<dc:creator><![CDATA[nz_hmz]]></dc:creator>
		<pubDate>Thu, 29 Oct 2015 01:57:17 +0000</pubDate>
		<guid isPermaLink="false">/?p=1780#comment-379500</guid>
		<description><![CDATA[Is this correct? I don&#039;t think your sorting implementationg will work correctly.]]></description>
		<content:encoded><![CDATA[<p>Is this correct? I don&#8217;t think your sorting implementationg will work correctly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>/2010/07/09/friday-algorithms-javascript-bubble-sort/comment-page-1/#comment-29824</link>
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Sun, 01 Jun 2014 23:56:09 +0000</pubDate>
		<guid isPermaLink="false">/?p=1780#comment-29824</guid>
		<description><![CDATA[Hooray for &quot;Bubble Sorting&quot;. Here&#039;s the way I write them in Javascript:


var arr = [9, 2, 1, 3, 0, 8, 7, 6, 5, 4, 10];

function bubbleSort(theArray) {
    var i, j;
    for (i = theArray.length - 1; i &#062;= 0; i--) {
        for (j = 0; j &#060;= i; j++) {
            if (theArray[j + 1] &#060; theArray[j]) {
                var temp = theArray[j];
                theArray[j] = theArray[j + 1];
                theArray[j + 1] = temp;
            }
        }
    }
    return theArray;
}

console.log(bubbleSort(arr));]]></description>
		<content:encoded><![CDATA[<p>Hooray for &#8220;Bubble Sorting&#8221;. Here&#8217;s the way I write them in Javascript:</p>
<p>var arr = [9, 2, 1, 3, 0, 8, 7, 6, 5, 4, 10];</p>
<p>function bubbleSort(theArray) {<br />
    var i, j;<br />
    for (i = theArray.length &#8211; 1; i &gt;= 0; i&#8211;) {<br />
        for (j = 0; j &lt;= i; j++) {<br />
            if (theArray[j + 1] &lt; theArray[j]) {<br />
                var temp = theArray[j];<br />
                theArray[j] = theArray[j + 1];<br />
                theArray[j + 1] = temp;<br />
            }<br />
        }<br />
    }<br />
    return theArray;<br />
}</p>
<p>console.log(bubbleSort(arr));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil LaNasa</title>
		<link>/2010/07/09/friday-algorithms-javascript-bubble-sort/comment-page-1/#comment-18008</link>
		<dc:creator><![CDATA[Phil LaNasa]]></dc:creator>
		<pubDate>Wed, 26 Dec 2012 14:45:56 +0000</pubDate>
		<guid isPermaLink="false">/?p=1780#comment-18008</guid>
		<description><![CDATA[Thanks, saved me the trouble of doing it myself.  Quick note - should probably declare the temp variable as private outside of the loop:

var swapped, temp;]]></description>
		<content:encoded><![CDATA[<p>Thanks, saved me the trouble of doing it myself.  Quick note &#8211; should probably declare the temp variable as private outside of the loop:</p>
<p>var swapped, temp;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tony</title>
		<link>/2010/07/09/friday-algorithms-javascript-bubble-sort/comment-page-1/#comment-16508</link>
		<dc:creator><![CDATA[tony]]></dc:creator>
		<pubDate>Wed, 29 Aug 2012 20:24:33 +0000</pubDate>
		<guid isPermaLink="false">/?p=1780#comment-16508</guid>
		<description><![CDATA[after your while statement, use 
&lt;pre lang=&quot;PHP&quot;&gt;
for(i=0;i&#060;a.length;i++)
{
    document.write(a[i]+&#034; ` &#034;);
}
&lt;/pre&gt;
it should help to compare the array.]]></description>
		<content:encoded><![CDATA[<p>after your while statement, use </p>
<pre lang="PHP">
for(i=0;i&lt;a.length;i++)
{
    document.write(a[i]+&quot; ` &quot;);
}
</pre>
<p>it should help to compare the array.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>/2010/07/09/friday-algorithms-javascript-bubble-sort/comment-page-1/#comment-14278</link>
		<dc:creator><![CDATA[peter]]></dc:creator>
		<pubDate>Mon, 02 May 2011 13:46:37 +0000</pubDate>
		<guid isPermaLink="false">/?p=1780#comment-14278</guid>
		<description><![CDATA[no]]></description>
		<content:encoded><![CDATA[<p>no</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alandra</title>
		<link>/2010/07/09/friday-algorithms-javascript-bubble-sort/comment-page-1/#comment-13241</link>
		<dc:creator><![CDATA[alandra]]></dc:creator>
		<pubDate>Wed, 14 Jul 2010 10:00:31 +0000</pubDate>
		<guid isPermaLink="false">/?p=1780#comment-13241</guid>
		<description><![CDATA[Is that correct?]]></description>
		<content:encoded><![CDATA[<p>Is that correct?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
