Domanda

Set={a,b} and L7:"All words that begin with an a and end with a b" is given L7 can be defined by

a(a+b)*b

What is the meaning of "+" ? And, How to solve this problem ?

È stato utile?

Soluzione

a       # first letter is always 'a'
(a+b)*  # zero or more sequence of letters 'a' or 'b' [one letter at time]
b       # last letter is always 'b'

Here + means or and then consequently, we have the below results:

ab
abb
abbb
aaab
abbbb
aaaab
abbbbb
aaaaab
.....
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top