# Question & Answer: For each of the languages L1, L2, L3, L4 described below:…..

Part A

For each of the languages L1, L2, L3, L4 described below:

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: For each of the languages L1, L2, L3, L4 described below:…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

(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.

L1:           For alphabet {a,b}, all strings that contain an odd number of a‘s and exactly one b.

L2:           For alphabet {0,1}, all strings of length 3 or less that have more 0‘s than 1‘s.

L3:           For alphabet {x,y,z}, all strings that contain xyx or zyz.

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

## Expert Answer

L1: For alphabet {a,b}, all strings that contain an odd number of a’s and exactly one b.
(a(aa)*b)

————————————————————————————————————————————————–

L2:For alphabet {0,1}, all strings of length 3 or less that have more 0’s than 1’s.
(001)*

—————————————————————————————————————————————————

L3: For alphabet {x,y,z}, all strings that contain xyx or zyz.
(xyz)*(xyx|zyz)(xyz)*

————————————————————————————————————————————————–

L4: For alphabet {p,q,r}, all strings that contain the substring rqr or end with pp.
(pqr)*((rqr) | pp)