Machine-translated by Google. Questions are authored in English.
Top

Discussion

Give regular expression for the language that contains all strings with at least one occurrence of each symbol in Σ = {a, b, c},.

  • A.(a + b + c)* abc (a + b + c)*
  • B.(a + b + c)* a (a + b + c)* b (a + b + c)* c (a + b + c)*
  • C.(a + b + c)* a (a + b + c)* b (a + b + c)* c
  • D.a (a + b + c)* b (a + b + c)* c (a + b + c)*

Answer: B

Of the options, the key's answer is (a + b + c)* a (a + b + c)* b (a + b + c)* c (a + b + c)*.

It allows any symbols before, between and after one a, one b and one c, so every string it matches contains all three symbols.

The other options are more restrictive. The first needs the substring abc, missing strings such as acbbc. The third must end in c, and the fourth must begin with a.

Strictly, this expression only matches strings in which some a comes before some b, which comes before some c, so a string such as cba is missed; a complete expression would combine all six orders. The paper's option set does not include that, and B is the most general of the four.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.