Cfg Solved Examples -

That means m=3 not reachable for n=2 in this grammar? Correct — known property: this grammar gives m = n + k where k is number of times you used aSbb. For n=2, k can be 0 or 1 or 2 → m=2,3,4 possible. Yes, so m=3 possible: n=2,k=1 → S → aSbb → a(aεbb)bb? Let’s do stepwise:

: [ S \to aS \mid bS \mid \varepsilon ] Wait — that gives any length. Let's fix: cfg solved examples

: [ S \Rightarrow aSb \Rightarrow aaSbb \Rightarrow aaaSbbb \Rightarrow aaabbb ] 5. Example 4 – ( a^n b^m ) with ( n \le m \le 2n ) Language : ( a^n b^m \mid n \ge 0, m \ge n, m \le 2n ) That means m=3 not reachable for n=2 in this grammar

: [ S \to aSbS \mid bSaS \mid \varepsilon ] Yes, so m=3 possible: n=2,k=1 → S → aSbb → a(aεbb)bb

 
X
Get 5 Star verified winning picks on MLB, NHL, NBA and NFL + Anti-Vegas Smart and Sharp Money Signals!
Enter your email where to send the picks:
Send Picks!
X