in reply to Re^18: [OT] The interesting problem of comparing (long) bit-strings.
in thread [OT] The interesting problem of comparing bit-strings.
I don't know if I'd call it B-M-H either. B-M-H-S, perhaps. :-)
There are three crucial differences over Horspool as far as I can see:
Larger exponent base for (tail end of) the delta[] could cover the full range, so the last two points are separate issues.
Window limit actually makes a lot of sense. In a random run of characters, they'll all be seen soon enough. There won't be many deltas above 5*(1<<BITS) #1; any further preprocessing would be wasted effort. (On random patterns.) Or, to put it another way, the limit acknowledges the hardware constraints (register, cache, memory sizes).
The same limit can apply to other searches— B-M, skip search, etc. With the limit in place, they all become O(1) in preprocessing. Effectively, you only search for a part of the pattern. The slow compare, however, is done on the full pattern.
#1 exp(-5) = .0067
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^20: [OT] The interesting problem of comparing (long) bit-strings.
by BrowserUk (Patriarch) on Apr 04, 2015 at 01:38 UTC |