Talk:Binary search: Difference between revisions

Content deleted Content added
Ieopo (talk | contribs)
Line 57:
div is integer division (discard any remainder)
 
------------
 
In practice, the non-recursive algorithm would be implemented with some minor changes: [[User:Robocoder|Robocoder]] 15:02, 12 November 2005 (UTC)
 
* To avoid overflowing (e.g., left+right > maxint), calculate:
mid := floor(left+(right-left)/2)
* Searching the top half of the array is implied and does not require the conditional test:
'''if''' value > a[mid]
 
------------
 
==Bridging ideas==
Has anyone else noticed that the part with the example of guessing numbers between 1-16 and the part with the pseudocode etc, aren't very well connected? Someone who don't already know what binary search is, and how it works, might not make the connection?