0% found this document useful (0 votes)
22 views5 pages

toc problem solving

The document outlines the construction of a DFA for the language L = {a b^n a^m : n ≥ 2, m ≥ 3}, conversion of an NFA to an equivalent DFA, and the creation of context-free grammars for specific languages. It provides step-by-step solutions for each task, including state transitions and grammar rules. The document is part of a Theory of Computation course at CBIT Kolar for the academic year 2024-25.

Uploaded by

nomikareddy34
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)
22 views5 pages

toc problem solving

The document outlines the construction of a DFA for the language L = {a b^n a^m : n ≥ 2, m ≥ 3}, conversion of an NFA to an equivalent DFA, and the creation of context-free grammars for specific languages. It provides step-by-step solutions for each task, including state transitions and grammar rules. The document is part of a Theory of Computation course at CBIT Kolar for the academic year 2024-25.

Uploaded by

nomikareddy34
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/ 5

THEORY OF COMPUTATION 2024-25

1.Construct a DFA for L = {a b^n a^m : n ≥ 2, m ≥ 3}

Sol: Step 1: Note the different values of n, and m, and list the corresponding
words for the different values.

Step 2: We make the last state the final state to signify acceptance of the string.
Finally, we add a reject state to send input sequences that are not in the
language.

Step 3:Test the DFA with sample strings.

Step 4: final output.

Dept of AIML,CBIT Kolar 1


THEORY OF COMPUTATION 2024-25

2. Convert the following NFA to an equivalent DFA

Sol: Step 1:The first step is to figure out what the start state of the equivalent DFA is

Step 2:The next step would be to see what subset of states this state would transition
to upon a 0.

Dept of AIML,CBIT Kolar 2


THEORY OF COMPUTATION 2024-25

Step 3: In JFLAP click the state expander button, then click the state that you
want to expand.

Step 4: Repeat the process of clicking the state expander button and then clicking
the states.

Step 5: The last part would be to determine the final states.

Final state:

Dept of AIML,CBIT Kolar 3


THEORY OF COMPUTATION 2024-25

3.Write a context-free grammar for L = {a^n b^m c^k : n+2m=k, n≥0, m≥0}.

Sol: Step 1: Note the different values of n, m, and k and list the corresponding words for
the different values.
L = { λ, bcc, ac, abccc, abbccccc ..}

Step 2:Using S as the start symbol, fill the first row with S -> aSc like so:

Step 3:Assigne all the values.

Step 4:final output.

Dept of AIML,CBIT Kolar 4


THEORY OF COMPUTATION 2024-25

4. Write a context-free grammar that generates the following language L


over the alphabet Σ = {a, b}: L = { w | w contains at least two a symbols }
Sol: S → XaXaX
X → ε | aX | bX
Step 1. Enter this grammar into JFLAP

Step 2. Check the type of grammar using Test > Test for Grammar Type.
Verify known strings using Input > Multiple Brute Force Parse.

Step 3. Give input as generate lanuage. Step 4: final output

Dept of AIML,CBIT Kolar 5

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy