Let πΏ1 be the language represented by the regular expression πβππββ¦
2024
Let πΏ1 be the language represented by the regular expression πβππβ (ππβππβ)β and πΏ2 = { π€ β (π + π)β | |π€| β€ 4}, where |π€| denotes the length of string π€. The number of strings in πΏ2 which are also in πΏ1 is ___________
Answer: 15 β Key insight: the language L1 consists exactly of all strings over {a,b} that contain an odd number of a's (at least one). Reason: The expression b* a b* (a b*β¦
Attempted by 86 students.
Show answer & explanation
Correct answer: 15
Key insight: the language L1 consists exactly of all strings over {a,b} that contain an odd number of a's (at least one).
Reason: The expression b* a b* (a b* a b*)* has one initial a and each repetition adds two a's, so the total number of a's is 1 + 2k (always odd).
Length 0: 0 strings in L1 (no a's).
Length 1: 1 string with an odd number of a's (a).
Length 2: 2 strings with an odd number of a's (exactly one a).
Length 3: 4 strings with an odd number of a's.
Length 4: 8 strings with an odd number of a's.
Total: 1 + 2 + 4 + 8 = 15 strings.
A video solution is available for this question β log in and enroll to watch it.