Final answer:
The given grammar ({S}, {a, b}, S, P) with productions S → bSaS| aSbS | λ is ambiguous.
Step-by-step explanation:
In the given grammar ({S}, {a, b}, S, P) with productions S → bSaS| aSbS | λ, we can show that it is ambiguous. Let's analyze the productions:
- S → bSaS: This production allows us to generate a string that begins with 'b', followed by any number of 'a's, and ends with 'b's. For example, we can generate 'babaabb'.
- S → aSbS: This production allows us to generate a string that begins with 'a', followed by any number of 'b's, and ends with 'a's. For example, we can generate 'ababbaa'.
- S → λ: This production allows us to generate an empty string.
Now, consider the string 'ab'. We can derive this string using two different derivations: S → aSbS → ab and S → bSaS → ab. Therefore, the grammar is ambiguous as it can generate the same string using different derivations.