CYK Algorithm For String Parsing
CYK Algorithm For String Parsing
S → AB | BC
A → BA | a
B → CC | b
C → AB | a
We will apply the CYK algorithm to the string baaba.
1
• Substring ab (positions 3-4):
T [3, 4] = {S} because S → AB
2
Exercise 4.3: Time Complexity
The time complexity of the CYK algorithm is O(n3 |G|), where: