find the no of strings of length <= 3 generated by the (a + ab)

find the no of strings of length <= 3 generated by the (a + ab)

Answer: 5To find the number of strings of length <= 3 generated by the regular expression (a + ab), we analyze valid combinations formed using 'a' and 'ab'. Length 1:…

Attempted by 13 students.

Show answer & explanation

Correct answer: 5

To find the number of strings of length <= 3 generated by the regular expression (a + ab), we analyze valid combinations formed using 'a' and 'ab'.

Length 1: Only 'a' is valid, as 'ab' has length 2.

Length 2: Possible strings are 'aa' (a + a) and 'ab' (direct use of ab).

Length 3: Valid strings are 'aaa' (a + a + a), 'aab' (a + ab), and 'aba' is invalid as it cannot be formed by concatenating only 'a' and 'ab'.

Thus, valid strings are: 'a', 'aa', 'ab', 'aaa', 'aab'. Total = 5.

हिन्दी उत्तर: (a + ab) से लंबाई <= 3 की स्ट्रिंग्स का उत्पादन करने पर, 'a', 'aa', 'ab', 'aaa', 'aab' वैध हैं। कुल 5 स्ट्रिंग्स हैं।

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…