VISVESVARAYA TECHNOLOGICAL UNIVERSITY
“Jnana Sangama”, Belagavi-590018, Karnataka
Assignment
on
“Theory of Computation”
Submitted in partial fulfilment of the requirements for the subject
Theory of Computation (BCS503)
as part of the curriculum for the
Bachelor of Engineering
In
CSE (Data Science)
Submitted by
Harsha K L
1BI22CD015
Under the Guidance of
Prof. Lakshmi B.N
Assistant Professor
BANGALORE INSTITUTE OF TECHNOLOGY
K. R. Road, V. V. Pura, Bengaluru – 560004
Department of CSE (Data Science)
2024-25
Theory of Computation
TABLE OF CONTENTS
1. TABLE OF CONTENTS …………………………………...2
2. ACKNOWLEDGMENT ……………………………………3
3. Assignment 1 ………………………………………………..4
3.1. Question 1 ………………………………………….4
3.2. Question 2 ………………………………………….4
3.3. Question 3 ………………………………………….5
3.4. Question 4 ………………………………………….6
3.5. Question 5 ………………………………………….7
3.6. Question 6 ………………………………………….8
4. Assignment 2 ………………………………………………..9
5. Conclusion …………………………………………………10
Dept of CSE (Data Science) 2024-2025 2
Theory of Computation
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to Prof Lakshmi B N for
their guidance and support throughout the completion of this assignment.
Their insights and teaching have greatly enhanced my understanding of the
concepts in the theory of computation.
I also extend my thanks to my classmates and peers for their valuable
discussions and encouragement. Additionally, I would like to acknowledge
the invaluable resources provided by educational YouTube channels such
as Gate Smashers and Neso Academy, which simplified complex topics
and enhanced my learning experience.
Finally, I am grateful for all the resources and learning materials that
served as the foundation for this work.
.
Dept of CSE (Data Science) 2024-2025 3
Theory of Computation
Assignment 1
MARKS-10 JFLAP is a package of graphical tools which can be used as an aid in
learning the basic concepts of Formal Languages and Automata Theory. Using JFLAP
Tool students can create and simulate nondeterministic finite automata (NFA)/
deterministic finite automaton (DFA)/ nondeterministic pushdown automata/ multi-
tape Turing machines/ several types of grammars/ parsing.
1. Obtain a DFA to accept strings of 0’s and 1’s starting with at least two 0’s and
ending with at least two 1’s
2. Design a DFA that accepts strings with an even number of a’s over {a, b}.
Dept of CSE (Data Science) 2024-2025 4
Theory of Computation
3. Obtain the equivalent DFA for the following e-NFA
Dept of CSE (Data Science) 2024-2025 5
Theory of Computation
4. Design a DFA that accepts binary strings (interpreted as binary numbers)
divisible by 5
Dept of CSE (Data Science) 2024-2025 6
Theory of Computation
5. Draw a DFA to accept the language L = {w: na(w) >= 1, nb(w) = 2}
Dept of CSE (Data Science) 2024-2025 7
Theory of Computation
6. Design a DFA to recognize binary strings of even length that are also
palindromes.
Dept of CSE (Data Science) 2024-2025 8
Theory of Computation
Assignment 2
Develop an application using theory of computation concepts
Balanced Parenthesis Checker: Below given is a carefully designed push-down automaton for
checking whether or not a given set of parenthesis sequence is balanced or not.
Validating the PDA on different test cases:
Dept of CSE (Data Science) 2024-2025 9
Theory of Computation
The PDA constructed can be represented as M = (Q, Σ, Γ, δ, q0, Ζ, F), where
Q = {start, s1, s2}
Σ = { (, ) }
Γ={(}
q0 = start
Ζ=z
F = {s1}
δ=
Current State Input Stack Top Stack Action Next State
start ϵ ϵ Push Z S1
S1 ( Z Push (, Z S2
S2 ( ( Push (, ( S2
S2 ( Z Push (, Z S2
S2 ) ( Push ϵ S2
S2 ϵ Z Push ϵ S1
Applications
1. Programming Syntax Validation: Ensures proper nesting of (), {}, and [] in code.
2. Mathematical Expression Validation: Verifies parentheses in complex formulas.
3. HTML/XML Parsing: Checks correct nesting of tags.
4. Data Serialization Formats: Validates balanced structures in JSON or YAML.
5. Text Editor Features: Auto-detection of mismatched brackets in code
Tools Used
https://automatonsimulator.com/
Dept of CSE (Data Science) 2024-2025 10
Theory of Computation
Conclusion
In this assignment, we explored key concepts of the Theory of Computation, emphasizing their
relevance in understanding the fundamental principles of computation and formal languages. By
analyzing [finite automata, context-free grammars, Turing machines], we gained deeper insights into
how theoretical models underpin modern computational systems. This study highlights the
importance of abstraction in solving complex problems and lays a strong foundation for advanced
studies in computer science. The application of these concepts fosters better problem-solving
techniques and strengthens our ability to design efficient algorithms.
Dept of CSE (Data Science) 2024-2025 11