DFA Designing string contains sub string s
Duration: 6 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Discrete Mathematics: Set Theory, Relations, Functions, Graph Theory, Group Theory, Propositional and Predicate Logic
- DataBase Management System/DBMS: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, SQL, Relational Calculus, Transaction Management, Concurrency Control
- Digital Electronics: Digital Systems & Boolean Basics, Logic Gates & Hardware, Boolean Expression, Boolean Minimization, Combinational Circuit, Sequential Circuits, Number System, Number Representation
- Computer Architecture: Floating Point Rep, Cache Memory Organization, Input Output Organisation, Pipelining, Instr Formats & Modes, Control Unit Design
- Operating System: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Threads & Process Creation, Deadlock, Memory Management, Virtual Memory, Disc Scheduling, File Management
- C Language: C Fundamentals, Control Flow, Functions, Arrays & Pointers, Storage Classes, Structures & Enums, DMA, Macros, Scoping & File Handling
- Data Structures: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
- Algorithms: Algorithm Analysis, Time Complexity Analysis, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Minimum Spanning Trees, Shortest Path Algos
- Computer Networks: Introduction to CN, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware Basics
- Theory Of Computation/Automata Theory: Introduction to TOC, Deterministic FA (DFA), Non-Deterministic FA, Regular Expressions, Grammar, Regular Language Properties, Moore & Mealy Machines, Pushdown Automata & CFG, Turing Machines, Complexity Theory
- Compiler Design: Intro to Compilers, Lexical Analysis, Grammar & CFG, Syntax Analysis: Top-Down, Syntax Analysis: Bottom-Up, Semantic Analysis & SDT, Intermediate Code Gen, Code Optimization, Run Time Environment
- Engineering Mathematics: Permutation and Combination, Linear Algebra, Calculus, Probability, Statistics
- General Aptitude: Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Logarithm, Number System, HCF LCM, Sequence and Series (Series), Speed Time and Distance, Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Percentage, Mensuration and Geometry, Mental Ability, Arithmetic, Profit and Loss, Powers and Exponents (Surds and Indices), Average, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Syllogisms, Venn Diagram, Seating Arrangements, Blood Relations, Directions (Direction Test), Analogy, Algebra, Time and Work, Analytical Reasoning (Counting Figures Reasoning), Puzzle Solving (Puzzles), Cubes & Dices, Ranking, Order and Sequence, Mixture and Alligation, Age Problems, Clock, Selection Decision Table (Decision Making), Data Arrangement
- English (Verbal Aptitude): Vocabulary, Noun, Subject Verb Agreement (Verb Noun Agreement), Adjectives, Tenses, Pronoun, Preposition, Direct and Indirect Speech, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Completion (Fill in the blanks), Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Sentence Correction (Error Correction), Verbal Analogy (Word Based Analogy), Conjunction, Interjection, Verb, Articles, Adverb, Modals, Sentence Construction
- Live Classes Recordings(Earlier Batch): GATE 2026 Live Class
- Full Mock Test:
- Previous Year Papers:
- GATE 2026 Counselling: Counselling and Guidance Sessions
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This educational video lecture demonstrates how to design a minimal Deterministic Finite Automaton (DFA) that accepts all strings over the alphabet {a, b} containing a specific substring. The instructor, Sanchit Jain, begins by defining the problem and listing two examples: substring 'abb' and substring 'aba'. He systematically constructs the DFA for 'abb', starting with an initial state and adding transitions for each character of the substring. He carefully handles edge cases and overlaps, such as input 'a' at state q2 (having seen 'ab'), redirecting it to state q1. He then briefly sketches the DFA for 'aba', showing similar state transitions. Finally, he concludes with a general rule for constructing such DFAs, stating that a substring of length m requires m+1 states and does not necessitate a dead state.
Chapters
0:00 – 2:00 00:00-02:00
The video opens with the problem statement on the whiteboard: 'Design a minimal DFA that accepts all strings over the alphabet {a, b}, where every accepted string 'w' contains sub string s.' The instructor lists two examples: i) abb and ii) aba. He begins constructing the DFA for the first example, 'abb'. He draws four states labeled q0, q1, q2, and q3. He draws a transition from q0 to q1 on input 'a', from q1 to q2 on input 'b', and from q2 to q3 (the final state) on input 'b'. He adds a self-loop on q0 for input 'b' and a self-loop on q1 for input 'a'. He then addresses the case where the input is 'a' while in state q2 (having seen 'ab'), drawing a transition from q2 back to q1 to handle the overlap in strings like 'aba'.
2:00 – 5:00 02:00-05:00
The instructor continues refining the DFA for 'abb', adding self-loops on the final state q3 for both 'a' and 'b' to indicate that once the substring is found, any subsequent characters are accepted. He writes example strings like 'abbab' and 'abba' to verify the logic. He then moves to the second example, 'aba'. He draws a new set of states q0, q1, q2, q3. He draws transitions: q0 to q1 on 'a', q1 to q2 on 'b', and q2 to q3 on 'a'. He adds a self-loop on q0 for 'b' and a self-loop on q1 for 'a'. He draws a transition from q2 to q0 on input 'b'. He adds self-loops on the final state q3 for 'a' and 'b', emphasizing that the machine remains in the accepting state once the substring is detected.
5:00 – 5:53 05:00-05:53
The instructor presents a 'Conclusion' slide summarizing the general method. He writes the formula: 'if w = xsx, |s| = m, then no of states in the DFA is m+1'. He underlines that there is 'No need of dead state' because all transitions can be managed within the existing states. He also notes that one 'Can loop on final state'. He explains that for any substring of length m, the minimal DFA will require exactly m+1 states, covering the start state through the final accepting state, without needing a separate trap or dead state for invalid inputs.
The lecture progresses from a specific problem definition to the practical construction of DFAs for substrings 'abb' and 'aba'. The instructor demonstrates the step-by-step addition of states and transitions, highlighting the critical logic of handling overlaps where a prefix of the substring matches a suffix of the current input. The lesson culminates in a generalized rule for such problems, establishing that a substring of length m necessitates m+1 states and that a dead state is unnecessary, as the automaton can always transition to a relevant previous state.