is(1+01)*(0+00+epsilon)(1+01)* correct?

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

0 votes

What will be the regular expression for the language consisting of all binary strings which have at most one pair of consecutive zeroes?

+5 votes

Best answer

Break it down into : "Exactly One Pair of Consecutive Zeroes" $+$ "NO pair of Consecutive zeroes"

Now,

"Exactly One Pair of Consecutive Zeroes" = $(1 + 01)^* \,00 (1+10)^*$

"NO pair of Consecutive zeroes" = $(1 + 01)^*(0 + \in) $

So, Now combine these Two and We will have :

The regular expression for the language consisting of all binary strings which have at most one pair of consecutive zeroes :

$(1 + 01)^* \,00 (1+10)^*$ $+$ $(1 + 01)^*(0 + \in) $

(You could take $(1 + 01)^*$ common and simplify further But for understanding purpose, let it be the way it is)

- All categories
- General Aptitude 1.4k
- Engineering Mathematics 5.7k
- Digital Logic 2.2k
- Programming & DS 4.1k
- Algorithms 3.6k
- Theory of Computation 4.5k
- Compiler Design 1.7k
- Databases 3.2k
- CO & Architecture 2.8k
- Computer Networks 3.2k
- Non GATE 1.1k
- Others 1.5k
- Admissions 503
- Exam Queries 474
- Tier 1 Placement Questions 22
- Job Queries 61
- Projects 13

39,752 questions

46,767 answers

140,664 comments

58,538 users