- Related Questions & Answers
- Construct DFA with Σ= {0,1} accepts all strings with 0.
- Validate input: replace all ‘a’ with ‘@’ and ‘i’ with ‘!’JavaScript
- Program to build DFA that starts and ends with ‘a’ from the input (a, b)
- What is the use of ‘ALL’, ‘ANY’, ’SOME’, ’IN’ operators with MySQL subquery?
- Program to build DFA that starts and end with ‘a’ from input (a, b) in C++
- Replacing ‘public’ with ‘private’ in “main” in Java
- Why in MySQL, we cannot use arithmetic operators like ‘=’, ‘<’ or ‘<>’ with NULL?
- MySQL query to search a string ‘demo’ if someone mistakenly types ‘deom’?
- In the query [SELECT column1, column2 FROM table_name WHERE condition; ] which clause among ‘SELECT’, ‘WHERE’ and ‘FROM’ is evaluated in the last by the database server and why?
- How to Use ‘cat’ and ‘tac’ Commands with Examples in Linux
- Are ‘this’ and ‘super’ keywords in Java?
- ‘AND’ vs ‘&&’ operators in PHP
- C# program to replace all spaces in a string with ‘%20’
- Printing string in plus ‘+’ pattern in the matrix in C++
- Find all the names beginning with the letter 'a' or ‘b’ or ‘c’ using MySQL query?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Draw the state transition diagram over an alphabet Σ={a,b} that accepts the string starting with ‘ab’.

The formal definition of Deterministic Finite Automata (DFA) is as follows −

A DFA is a collection of 5-tuples as shown below −

**M=(Q, Σ, δ,q0,F)**

Where,

- Q: Finite set called states.
- Σ: Finite set called alphabets.
- δ: Q × Σ → Q is the transition function.
- q0 ∈ Q is the initial state.

The language is generated as given below −

L={ab,aba,abab,…….}

The transition diagram is as follows −

Here,

- D is a dead state.
- D is a transition state, which it can never escape. Such a state is called a trap state. It is called the dead state.

**ab**− q1 on’ a’ goes to q2 and q2 on ‘b’ goes to qf to reach final state. So, ab is accepted.**baa**− q1 on ‘b’ goes to D state, which is dead state. There is no way to reach the final state. So, baa is not accepted.

The transition table is as follows −

State/Input symbol | a | b |
---|---|---|

∈q1 | q2 | Dead state (D) |

q2 | Dead state (D) | qf |

qf | qf | qf |

D | - | - |

**Step 1**− q1 is an initial state on input a it goes to state q2 and on ‘b’ goes to dead state.**Step 2**− q2 on ‘a’ goes to dead state and on ‘b’ goes to qf which is the final state.**Step 3**− qf is the final state on input ‘a’ and ‘b’ goes to qf state itself.**Step 4**− D is a dead state, there is no path from D to any state.

Design a DFA which accepts a language over the alphabets Σ = {a, b} such that L is the set of all strings starting with ‘aba’.

All strings start with the substring “aba”.

Therefore, length of substring = 3.

Minimum number of states in the DFA = 3 + 2 = 5.

The language L= {aba,abaa,abaab,abaaba}

The transition diagram is as follows −

The transition table is as follows −

State/Input symbol | a | b |
---|---|---|

∈q0 | q1 | Dead state (D) |

q1 | Dead state (D) | q2 |

qf | qf | qf |

D | - | - |

Advertisements