<?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: Binary search an array in JavaScript</title>
	<atom:link href="http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/</link>
	<description>Web Freshness</description>
	<lastBuildDate>Thu, 21 Apr 2011 18:42:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: bob</title>
		<link>http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/comment-page-1/#comment-621</link>
		<dc:creator>bob</dc:creator>
		<pubDate>Thu, 21 Apr 2011 18:42:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.dweebd.com/?p=149#comment-621</guid>
		<description>the &quot;continue&quot;s are unnecessary if you just use if/else

    if (comparison &lt; 0)
        low = i + 1;
    else if (comparison &gt; 0)
        high = i - 1;
    else
        return i;</description>
		<content:encoded><![CDATA[<p>the &#8220;continue&#8221;s are unnecessary if you just use if/else</p>
<p>    if (comparison &lt; 0)<br />
        low = i + 1;<br />
    else if (comparison &gt; 0)<br />
        high = i &#8211; 1;<br />
    else<br />
        return i;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Hawk III</title>
		<link>http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/comment-page-1/#comment-591</link>
		<dc:creator>Jim Hawk III</dc:creator>
		<pubDate>Mon, 05 Jul 2010 23:44:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.dweebd.com/?p=149#comment-591</guid>
		<description>Oh, one more thing: 

&lt;code lang=&quot;ruby&quot;&gt;Array.prototype.binarySearch = function binarySearch(find, comparator)&lt;/code&gt;

is redundant.

&lt;code lang=&quot;ruby&quot;&gt;Array.prototype.binarySearch = function (find, comparator)&lt;/code&gt;

works just fine.</description>
		<content:encoded><![CDATA[<p>Oh, one more thing: </p>
<p><pre class="ruby"><span class="kw3">Array</span>.<span class="me1">prototype</span>.<span class="me1">binarySearch</span> = function binarySearch<span class="br0">&#40;</span>find, comparator<span class="br0">&#41;</span></pre></p>
<p>is redundant.</p>
<p><pre class="ruby"><span class="kw3">Array</span>.<span class="me1">prototype</span>.<span class="me1">binarySearch</span> = function <span class="br0">&#40;</span>find, comparator<span class="br0">&#41;</span></pre></p>
<p>works just fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Hawk III</title>
		<link>http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/comment-page-1/#comment-590</link>
		<dc:creator>Jim Hawk III</dc:creator>
		<pubDate>Mon, 05 Jul 2010 23:39:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.dweebd.com/?p=149#comment-590</guid>
		<description>Well, since I&#039;ve already tossed my hat in, it occurs to me that the return for a failed search should be -1, which stays with the pattern  established by String.indexOf.  Since null is not a number, and every other possible result of the function is a number, you really ought to stay with numbers rather than tossing in null.</description>
		<content:encoded><![CDATA[<p>Well, since I&#8217;ve already tossed my hat in, it occurs to me that the return for a failed search should be -1, which stays with the pattern  established by String.indexOf.  Since null is not a number, and every other possible result of the function is a number, you really ought to stay with numbers rather than tossing in null.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Hawk III</title>
		<link>http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/comment-page-1/#comment-589</link>
		<dc:creator>Jim Hawk III</dc:creator>
		<pubDate>Mon, 05 Jul 2010 23:33:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.dweebd.com/?p=149#comment-589</guid>
		<description>i = parseInt((low + high) / 2, 10);  ????

What&#039;s wrong with  i = Math.floor((low + high) / 2);  ?  parseInt has to turn the math result to a string, and then back to a number again, which wastes a lot of time.</description>
		<content:encoded><![CDATA[<p>i = parseInt((low + high) / 2, 10);  ????</p>
<p>What&#8217;s wrong with  i = Math.floor((low + high) / 2);  ?  parseInt has to turn the math result to a string, and then back to a number again, which wastes a lot of time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/comment-page-1/#comment-585</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 08 Apr 2010 14:24:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.dweebd.com/?p=149#comment-585</guid>
		<description>There is example of using search array functionality

http://vitana-group.com/article/javascript-dhtml/Iterator

as described here it supports any array items type, even array of json objects
Looks good</description>
		<content:encoded><![CDATA[<p>There is example of using search array functionality</p>
<p><a href="http://vitana-group.com/article/javascript-dhtml/Iterator" rel="nofollow">http://vitana-group.com/article/javascript-dhtml/Iterator</a></p>
<p>as described here it supports any array items type, even array of json objects<br />
Looks good</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: noah</title>
		<link>http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/comment-page-1/#comment-229</link>
		<dc:creator>noah</dc:creator>
		<pubDate>Wed, 21 Jan 2009 15:47:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.dweebd.com/?p=149#comment-229</guid>
		<description>Should the title be &quot;Binary *search* an array in JavaScript&quot;?</description>
		<content:encoded><![CDATA[<p>Should the title be &#8220;Binary *search* an array in JavaScript&#8221;?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic page generated in 0.538 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2011-10-20 17:10:16 -->

