hsu_wh@jhunix.HCF.JHU.EDU (William H Hsu) (07/01/90)
Has anyone ever seen the Boyer-Moore string matching algorithm implemented in C? I was recently shown a pseudo-Pascal description of it in the book _Computer Algorithms: Introduction to Design and Analysis_ by Sara Baase. Unfortunately, I have been bending over backwards trying to define the correct alphanumeric set (the book makes no mention of ASCII, merely referring to "for each ch in the alphabet Sigma") and can't even seem to get my program to drop the carriage return at the end of the "pattern file". I'm sure this problem has been solved before, but I have spent a week trying to debug my version to no avail, and would greatly appreciate it if someone could point out a previously existing implementation. I have already tried _Numerical Recipes in C_ and ACM publications from 1975-1980 which deal with Boyer and Moore's work. In the same vein, what is are the best standard I/O functions for converting my ASCII pattern-matching algorithms to work for binary data? I wrote up an efficient dynamic scanning program from the same book mentioned above, but am using "fgetc" and a vanilla recursive allocation scheme.