The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: UlliN on January 17, 2007, 08:26:23 AM

Title: Binary Search Algorithm
Post by: UlliN on January 17, 2007, 08:26:23 AM
Hello,

unlike Lib BinSearch algo, which provides a linear search in binary data, here's a "real" binary search algo "SearchAll" using sorted tables. Don't be bothered by the name, it's inspired by the homonymous COBOL-Command, which does the same ;-).
If the table contains duplicate elements, the returned index(if found) is any valid. There's another modificated algo SearchAll1 providing the lowest index. An appropriate string comparison algo is added and can also be used as callback function by C-bsearch(stdlib.h).
As always improvement would be appreciated.

Regards
Ulli




[attachment deleted by admin]