if ( bottom < top )
   mid = ( bottom + top ) / 2
   if ( dictionary[ middle ] < string )
      recursively search from mid + 1 to top
   else
      recursively search from bottom to mid
else
   if ( top < bottom )
      not found
   else
      found at bottom

Example 1: A lazy binary search.

Back to Article