0 votes 0 votes Write a regular expression for all strings of 0’s and 1’s in which there is an even number of 0’s between any two 1’s. Theory of Computation theory-of-computation strings regular-expression + – moe12leb asked Nov 27, 2022 retagged Nov 27, 2022 by makhdoom ghaya moe12leb 663 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Shoto commented Nov 28, 2022 reply Follow Share 0^*(1(00)^+1)^*0^* 0 votes 0 votes Pranavpurkar commented Nov 28, 2022 reply Follow Share @Aditya_ it cannot generate 11. 1 votes 1 votes Please log in or register to add a comment.
0 votes 0 votes $(0^{*} + 1(00)^{*}1)^{*}$ + $0^{*}10^{*}$ Pranavpurkar answered Nov 28, 2022 edited Dec 1, 2022 by Pranavpurkar Pranavpurkar comment Share Follow See all 4 Comments See all 4 4 Comments reply DevUt commented Dec 1, 2022 reply Follow Share Wouldn’t this also generate 101 0 votes 0 votes Pranavpurkar commented Dec 1, 2022 reply Follow Share DevUt check now. 0 votes 0 votes DevUt commented Dec 1, 2022 reply Follow Share It can still generate 11011 0 votes 0 votes Pranavpurkar commented Dec 1, 2022 reply Follow Share DevUt ohh yes, how you approached.? 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes $0^{*}(1(00 + 1)^{*} (0 + \epsilon ) + \epsilon)$ DevUt answered Dec 1, 2022 DevUt comment Share Follow See all 0 reply Please log in or register to add a comment.
–1 votes –1 votes Here is a regular expression that will match all strings of 0's and 1's in which there is an even number of 0's between any two 1's: ^(1(00)*1)*$ Explanation: ^ and $ anchor the regular expression to the start and end of the string, respectively. This ensures that the regular expression will only match the entire string and not just a substring. 1 matches the character 1. (00)* matches zero or more occurrences of the characters 00. This matches an even number of 0's. (1(00)*1)* matches zero or more occurrences of a 1 followed by an even number of 0's followed by a 1. This ensures that there is an even number of 0's between any two 1's. For example, this regular expression would match the following strings: 1 11 10001 10010001 And it would not match the following strings: 0 10 101 1001 1000101 100010001 rsansiya111 answered Dec 16, 2022 rsansiya111 comment Share Follow See all 0 reply Please log in or register to add a comment.