GATE | GATE CS Mock 2018 | Question 42

A regular expression is ambiguous when there exists a string which can be constructed in two different ways from the regular expression. Which of the following regular expressions are unambiguous?
(A) a((ab)*cd)* ∪ a(ababcb*)*a*
(B) aab*(ab)* ∪ ab* ∪ a*bba*
(C) aaba* ∪ aaaba ∪ aabba* ∪ a
(D) None of these


Answer: (C)

Explanation: (A) Ambiguous. For instance, the string a can be constructed by using a((ab)*cd)* or a(ababcb*)*a*.
(B) Ambiguous. The string abb can be constructed either by ab* or a*bba*.
(C) Unambiguous.

Option (C) is correct.


Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.