Question: (7 points) Let Lk={w{a,b}w contains a substring having k more b 's than a 's }. (a) Although at first glance this may seem to

(7 points) Let Lk={w{a,b}w contains a substring having k more b 's than a 's }. (a) Although at first glance this may seem to be a non-regular language, it is in fact a regular language. Give the state diagram of an NFA that recognizes L3 using the following design: - Loop continuously in the start state for any symbol read. - Any time a b symbol is read, also spawn a new branch that tests whether a substring beginning with this symbol reaches 3 more b 's than a 's at any point. - Any such spawned branch that hasn't yet reached this accepting state can be allowed to die out if it would otherwise return to an equal number of a 's and b 's (there's no need to retain the extra branch when there are equal a 's and b 's or an excess of a 's; a new branch will take over from the start state if another b is read). (b) Give a 5-tuple specifying NFA Nk such that L(Nk)=Lk. (Assume k3 )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
