Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I create a search file for text?
#2
Binary search of an array in alpha order call it arr$()

Mark the first item low = 1 mark the last item high = number of items

recalcMiddle:

if low > high then the item is not found in arr$() and you are done with unsuccessful search.

then middle = int(low + high)/2

now if the arr$(middle) > search item then move high to middle - 1 goto recalcMiddle

now if arr$(middle) < search item then low = middle + 1 goto recalcMiddle

now if arr$(middle) = search item then you've found it and are done!

You play the game, guess my number from 1 to 100, in just the same way!
b = b + ...
Reply


Messages In This Thread
RE: How can I create a search file for text? - by bplus - 01-25-2024, 10:48 PM



Users browsing this thread: 2 Guest(s)