Fall 2024 - CS402 - 1 - SOL
Fall 2024 - CS402 - 1 - SOL
Assignment # 01
Fall 2024 Deadline Date
Topic Covered:
The objective of this assignment is to assess the understanding of students about:
Regular Expression (RE)
Finite Automata (FA)
Transition Graph (TG)
Generalized Transition Graph (GTG)
NOTE
No assignment will be accepted after the due date via email in any case (whether
it is the case of load shedding or internet malfunctioning etc.). Hence refrain from
uploading assignments in the last hour of the deadline. It is recommended to
upload the solution file at least two days before its closing date.
a.
exact one b and can have any number of a’s (excluding none) before it, over the
Write the regular expression for language consists of all strings that ends and have
Solution:
a. a (a*) b
b.
a) If the regular expression is (𝑎𝑏)*, how many different strings of length 4 are in this
language?
b) If the regular expression is (𝑎∣𝑏)2, how many strings of length 2 can it generate?
c) If the regular expression is (𝑎𝑏∣𝑏𝑎)2, how many distinct strings of length 4 can be
generated?
Solution:
a) 1
( the only possible string of length 4 in this language is: abab. So, there is only 1
string of length 4 in the language L=(ab)∗.
(The 4 possible strings are: 𝑎𝑎 𝑎𝑏 𝑏𝑎 𝑏𝑏. So, the regular expression (𝑎∣𝑏)2 can
b) 4
c) 4