String Algorithms Flashcards
Finite Automata Algorithm
String Matching Algorithm
Advantage of Finite Automata Algorithm
Matching within a single run over the text string. It traverses the text string only once.
Why is it faster?
- Due to its preprocessing.
2. Types of string it matches. (unlike Aho Corasick)
Likely concept
Deterministic Finite Automata (DFA) in TOC.
Processes it goes through
Following is the set of processes :
- Construction of Finite Automata Machine for the pattern string.
- Once the preprocessing is completed text string will be passed through this automata and in the sequential order, it matches the states as well.
- The decision of being matched or not depending upon the current state after text string is finished.
Number of states in FA
Length of pattern + 1 (M + 1)
How to construct the Finite Automata for the pattern.
It is constructed using the concept of the borders just as like in the KMP algorithm. The KMP algorithm utilizes the concept of borders in order to use the mismatches for the matching with a prefix so that mismatch may do lesser harm to the overall matching procedure.
Describe the key point about process
The main point about the calculation of the finite automata states and their jumping from one to the other is done using the longest length borders that is available at the moment for the matching. As it matches the longest length returns the endpoint of the prefix to jump on.