282 views

1 Answer

2 votes
2 votes

Divide it into two part

S-> aSc|S1

S1->aS1b| $\epsilon$

Here first i produce as many c's as i want along with a

Second part i produce as many b's i want along with a

It also takes cares of case if i want only (a and b) or (only a and c) or none

no matter what if both b and c is $\neq$ 0 the there will be a followed by b followed by c

so first fill a and c it will  help to create an void in middle which can be filled with a and b

if still finding hard then take 2 or 3 strings in mind and design an tree structure of string it might give you an direction

Related questions

0 votes
0 votes
0 answers
2
admin asked Apr 11, 2019
311 views
Modify the $CYK$ algorithm to report the number of distinct parse trees for the given input, rather than just reporting membership in the language$.$
0 votes
0 votes
0 answers
3
admin asked Apr 11, 2019
157 views
Show that in any $CNF$ grammar all parse trees for strings of length $n$ have $2n-1$ interior nodes $(i.e.,$ $2n-1$ nodes with variables for lables$).$
0 votes
0 votes
0 answers
4
admin asked Apr 11, 2019
257 views
Using the grammar $G$ of Example $7.34,$use the $CYK$ algorithm to determine whether each of the following strings is in $L(G):$$ababa$$baaab$$aabab$