سؤال

Language: {a^m b^n : m ≤ 2n}

If someone could give advice on how to approach this to construct the grammar as well as a solution that would be great and much appreciated!

هل كانت مفيدة؟

المحلول

Some hints:

  1. Start with a grammar for { anbn | n in N }.

  2. The grammar you built in part (1) probably worked by laying down a's on one side of the string and b's on the other. That way, there end up being the same number of a's and b's. Try modifying the grammar so that you put down either one a or two a's each step.

Hope this helps!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top