Overview
Shift-And builds a bit mask for each alphabet symbol and updates a bit-vector of active pattern prefixes as each text character is read.
Uses bit masks to update all exact-match prefix states in parallel.
Compact metadata for implementation and discovery.
Shift-And builds a bit mask for each alphabet symbol and updates a bit-vector of active pattern prefixes as each text character is read.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n)
Average
O(n + m)
Worst
O(n + m)
Space
O(n + m)
Show tracking active prefix matches with bit masks on a small exact string matching example.
Shift-And is exact string matching; approximate variants need additional bit-vector states.
What each reference supports for this entry.
String algorithms reference for Shift-And Algorithm's pattern matching, suffix indexing, alignment, or sequence-processing mechanism.
Open sourceTextbook support for Shift-And Algorithm's algorithm family, complexity framing, and standard implementation concepts.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Pattern Matching · Core
Both address exact string matching, but they make different modeling or performance tradeoffs.
Compare with thisPattern Matching · Core
Both address longest common prefix array, but they make different modeling or performance tradeoffs.
Compare with thisPattern Matching · Core
Both address exact string matching, but they make different modeling or performance tradeoffs.
Compare with thisPattern Matching · Core
Prefix Function and Shift-And Algorithm solve related pattern preprocessing problems with different assumptions and tradeoffs.
Compare with thisShift-And Algorithm and Bit-Parallel Levenshtein solve related exact string matching problems with different assumptions and tradeoffs.
Shift-And Algorithm and Shift-Or Algorithm solve related exact string matching problems with different assumptions and tradeoffs.
Shift-And Algorithm and BNDM solve related exact string matching problems with different assumptions and tradeoffs.