0% found this document useful (0 votes)
16 views7 pages

Assignment NO1 NLP

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

Assignment NO1 NLP

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Assignment NO:1

NAME : MOUSA WAZIR


CLASS CODE: 2009-2021B
INSTRUCTOR: Junaid Khan
SUBJECT: NLP

Q1. Design the NFA for the following language sets:

1. a∗abb∗a^*ab b^*a∗abb∗:

• Solution: The NFA accepts strings where any number of 'a's is followed by "ab", and
then followed by any number of 'b's.

Diagram:
2. Strings ending in "00" or "11":

• Solution: The NFA accepts strings over the alphabet {0, 1} that end in either "00" or
"11".

Diagram:
3. Strings containing "the":

• Solution: The NFA accepts strings over the alphabet {a-z} that contain the substring
"the" anywhere in the input.

Diagram:
4. Strings ending in "ing":

• Solution: The NFA accepts strings over the alphabet {a-z} that end with the substring
"ing".

Diagram:
Q2. Design the DFA for the following language sets:

1. Strings containing 'a' and ending with 'a':

• Solution: The DFA accepts strings that contain at least one 'a' and must end with 'a'.

Diagram:

2. Strings following the patterns {0, 00, 11, 010, 101}:

• Solution: The DFA accepts strings that match any of the given patterns.
Diagram:
THE END

You might also like