nfa - Regex Pattern to Match Certain Rules -
update: turns out idiot , misread original problem. original problems specifies there must @ 3 of 4 letters used, not @ least. changes question , eliminates doubts when creating nfa , dfa. sorry , help!
for homework problem, have create regex pattern match these specifications...
- must composed of letters a, b, c, , d
- must in reverse alphabetical order
- must use @ least 3 of 4 given letters (a,b,c,d is, can have many total letters possible)
my answer confident (d+c+b+a*)|(d+b+a+)|(d+c+a+)|(c+b+a+). first question if correct. second if expression can simplified or altered @ all.
the next step draw graph non-deterministic finite automaton regex , having difficulty completing step.
as requested, here attempt @ nfa (rough sketch)
your answer fine me.
there 5 kinds of patterns match:
d+c+b+a+ c+b+a+ d+b+a+ d+c+a+ d+c+b+
(d+c+b+a+)|(c+b+a+)|(d+b+a+)|(d+c+a+)|(d+c+b+)
,which in following forms merging first pattern sub-fours:
(d+c+b+a*)|(d+b+a+)|(d+c+a+)|(c+b+a+) or (d*c+b+a+)|(d+b+a+)|(d+c+a+)|(d+c+b+) ...
a quite straight forward way me:
(d*c+b+a+)|(d+c*b+a+)|(d+c+b*a+)|(d+c+b+a*)
Comments
Post a Comment