• edited by
17,382 views
51 51 votes
Give a regular expression for the set of binary strings where every $0$ is immediately followed by exactly $k$ $1$'s and preceded by at least $k$ $1$’s  ($k$ is a fixed integer)

8 Answers

Best answer
79 79 votes
$1^*1^k(01^k)^* + 1^*$

This is correct expression, this considering chance of not having any $0$'s (In that case string can also be empty string ).

PS: The question assumes a fixed $k$, and we should expand the given expression for that $k$ to get a valid regular expression.
• edited by
1 flag:
✌ Edit necessary (Ysh 1 “Question says any regex , so the ans is any subset of your expression”)
10 10 votes
(1*1^k(01^k)*) * +  1*

plz correct me !!
8 8 votes
The expression will be of the form $1^*1^k(01^k)^*$.
7 7 votes

 

1∗1k(01k)∗+1∗  

is correct answer for this because if even a single 0 come's then then next zero if any must come at a distance of k consecutive 1;s otherwise it will violate the property that a zero should be followed by exactly k 0's .thus all 0's must be at a distance of k 1's exactly. lso if no 0 is there then there is no constraint so 1* is added.

2 2 votes

1*1k(0 1k)* + 1*    should be the required RE

1 1 vote

We need to make sure that if a zero has appeared then after that only 1^k is only possible and nothing else as a result of that block keeps on repeating.

Position:
Show:

Related questions

63 63 votes
9 answers 9 answers
33.9k
33.9k views
Kathleen asked Sep 25, 2014
33,869 views
The string $1101$ does not belong to the set represented by$110^*(0 + 1)$$1(0 + 1)^*101$$(10)^*(01)^*(00 + 11)^*$$(00 + (11)^*0)^*$
54 54 votes
6 answers 6 answers
17.8k
17.8k views
Kathleen asked Sep 25, 2014
17,830 views
If the regular set $A$ is represented by $A = (01 + 1)^*$ and the regular set $B$ is represented by $B = \left(\left(01\right)^*1^*\right)^*$, which of the following is t...
28 28 votes
4 answers 4 answers
10.6k
10.6k views
Kathleen asked Sep 25, 2014
10,573 views
Which of the following statements is false?Every finite subset of a non-regular set is regularEvery subset of a regular set is regularEvery finite subset of a regular set...
25 25 votes
2 answers 2 answers
10.2k
10.2k views
Kathleen asked Sep 25, 2014
10,236 views
Regarding the power of recognition of languages, which of the following statements is false?The non-deterministic finite-state automata are equivalent to deterministic fi...