regular expression for the language L = { w ∈ {0,1}* | w has no pair of…

2013

regular expression for the language L = { w ∈ {0,1}* | w has no pair of consecutive zeros } is

  1. A.

    (1 + 010)*

  2. B.

    (01 + 10)*

  3. C.

    (1 + 010)* (0 + ε)

  4. D.

    (1 + 01)* (0 + ε)

Attempted by 55 students.

Show answer & explanation

Correct answer: D

To construct a regular expression for binary strings without consecutive zeros, consider valid blocks. Every zero must be followed by a one unless it is the last character. This allows repeating patterns of '1' or '01'. The expression (1 + 01)* covers these internal blocks. Finally, allow an optional trailing zero with (0 + ε). Thus, the regex is (1 + 01)*(0 + ε).

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor