Question & Answer: Write a regular expression for the language……

(1)

Write a regular expression for the language.

(2)

Define a finite state machine (FSM) that recognizes words in the language (input alphabet, states, start state, state transition table, and accept states). Include a state digraph for the FSM.

A: For alphabet {p,q,r}, all strings that contain the substring rqr or end with pp.

Expert Answer

 

given alphabet{p,q,r}

a regular expression for DFA

large qs=xi +q3q+q1q

large q1=qsp +q2p+q3p

large q2=qsr+q1r+q2r

large q3=q2q

large q4=q3r

large qf=q1p+q4p+q4r+q4q

now taking qf

large qf=q1p+q4p+q4r+q4q

putting the value of q4

qf=q1p+q3rp+q3rq+q4rr

now putting the value of q1

qf=qsp+q2p+q3p+q3rp+q3rq+q4rr

now putting the value of q3

qf= q2p+q2qp+q2qrp+q2qrq+q4qrr

qf= q2(p+qp+qrp+qrq+qrr)

regular expression for rqr will become

{pqr{r+q+r)*pqr}{(p+p)*}

transition table:

state diagraph of the dfa:

Still stressed from student homework?
Get quality assistance from academic writers!