Professional Documents
Culture Documents
Session (2017-2021)
Class: BSCS 5th
Submitted By Name: Muhammad Usman
Roll Number: 5396
Submission Date: 18-09-2019
Submitted To: Sir Amir Khan
1
Question 1: Consider the language S*, where s = {a,b}. How many
words does this language have of length 2? Of length 3? Of length n?
Answer: If we have a language S* where S = {a,b}
then we have the total letters in alphabet = n
length/power = m
Now we have the value of n= 2,3,n.
If m=2
Length 22= 2, {aa, ab,ba,bb}
Length 23=8, {aaa, aab, aba, abb, baa, bab, bba bbb}
Length 2n= 2n , {a, b, aa, bb, aaa, bbb,aaaa,bbbb,………}
Question 3: Consider the language S*, where S = {ab,ba}. Write out all
the words in S* that have seven or fewer letters. Can any word in the
language contain the substrings aaa or bbb?
Answer:
Words of length 0: empty
Words of length 2: ab, ba
Words of length 4: abab, abba, baab, baba
Words of length 6: ababab, ababba, abbaab, abbaba, baabab, baabba, babaab,
bababa
No words can contain aaa or bbb because the first a in a string ab and the a in ba
never allow to make aaa or bbb.