Dynamic programming of CYK algorithm, with running time O(n^3 |G|), where n is the length of the string and G is the grammar set.