Re: Search algorithm
- From: Richard Heathfield <invalid@xxxxxxxxxxxxxxx>
- Date: Sun, 04 Jun 2006 20:09:14 +0000
Richard Heathfield said:
<snip>
while left <= right and haystack[guess] <> needle
guess = (left + right) / 2
if haystack[guess] < needle
left = guess + 1
else if haystack[guess] > needle
right = needle - 1
right = guess - 1
Sorry about that.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.
- References:
- Search algorithm
- From: Eitan M
- Re: Search algorithm
- From: Richard Heathfield
- Search algorithm
- Prev by Date: Re: Search algorithm
- Next by Date: RFC: Capture Pentominoes
- Previous by thread: Re: Search algorithm
- Next by thread: RFC: Capture Pentominoes
- Index(es):
Relevant Pages
|