07-11-2003, 11:28 AM
Only problem I see is you have to have a soted list. But that's just me. ;*)
Challenge: Binary Search.
|
07-11-2003, 11:28 AM
Only problem I see is you have to have a soted list. But that's just me. ;*)
07-11-2003, 12:29 PM
Quote:Only problem I see is you have to have a soted list. But that's just me. ;*) Yeah, any binary search algorithm requires a sorted list.
07-11-2003, 09:56 PM
STERLING C,
--------------- Very nice, straightforward job. It works fine. I even modified it for only 1 table element, and it also works. RELSOFT, ----------- You're right, the list must be sorted. When the binary search function doesn't know where the list comes from, that is who made it, it would be adviseable for the function to do a quick sequence check on the list up front. If it's out-of-sequence, you should abort the program with a fatal error. TO ALL, -------- When you write this kind of general purpose routine for sorting or searching a table, you have to take into consideration that the routine may be given an empty table (null) or one with only 1 table element in it. *****
08-19-2003, 05:11 AM
I guess it's time I posted my old code for doing a binary search.
Code: REM "BINSER" BINARY SEARCH SUBROUTINE. Edward F. Moneo 02-Jun-89. |
« Next Oldest | Next Newest »
|