0

I tried to do it by myself and got this answer but this way of deducing the answer doesn't seem to match anyone's answer on the internet.

$$S \rightarrow aSbbB$$

$$B \rightarrow bB|\epsilon$$

Am I missing something?

Jean Marie
  • 81,803
  • Things to check: (1) can the S ever go away? (2) are you handling the edge cases properly (e.g., $i=0$ or $j=2i$)? – mjqxxxx Oct 28 '16 at 15:35

1 Answers1

1

Yes, you're missing something. Actually two things. First, if every instance of $B$ is chosen as $\epsilon$, you're left with a case where $j=2i$ rather than $j>2i$. Second, Every $S$ in your grammar contains another $S$ so it only produces infinite strings.

  • S--> aSbbB|e

    B--> bB|e where e means epsilon . Is tis correct?

    – Paritosh Potukuchi Oct 28 '16 at 15:56
  • Sorry, I gave a bad hint. To reiterate, you still need to fix the situation where $j=2i$ and you need to make sure your grammar doesn't accept the empty string. Your answer is really close, except that the second option for $S$ is a little bit off. What can you change it to to address both problems I mentioned? – Gabriel Burns Oct 28 '16 at 16:22