- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

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

# Design DFA for language over {0,1} accepting strings with odd number of 1’s and even number of 0’s

A Deterministic Finite automaton (DFA) is a 5-tuples

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

Where,

- Q : Finite set called states.
- Σ : Finite set called alphabets.
- δ : Q × Σ → Q is the transition function.
- q0 ϵ Q is the start or initial state.
- F : Final or accept state.

## Problem

Construct a DFA machine accepting odd numbers of 1’s and even number of 0’s.

## Solution

Design two separate machines for the two conditions over an alphabet Σ={0,1}:

DFA accepts only an odd number of 1’s.

DFA accepts only even number of 0’s.

Here,

s1 = start

s2=odd 1 or start 11

s3= starts 11 accepted and stay there

s4 = accept even 0, odd 1 and 0 1 0

s5=even 1, odd 0 and 0 1

s6=odd 1 odd 0

s7= odd 1 odd 0 start 010

s8=even 0 no 1

s0= odd 0 no 1

- Related Questions & Answers
- Design a DFA machine accepting odd numbers of 0’s or even numbers of 1’s
- Construct DFA of alternate 0’s and 1’s
- Count subarrays with equal number of 1’s and 0’s in C++
- Design a DFA of a string with at least two 0’s and at least two 1’s
- Count number of binary strings of length N having only 0’s and 1’s in C++
- Convert RE 1(0+1)*0 into equivalent DFA.
- Binary representation of next greater number with same number of 1’s and 0’s in C Program?
- Largest number with binary representation is m 1’s and m-1 0’s in C++
- Construct ∈-NFA of Regular Language L = 0(0+1)*1
- Maximum length of segments of 0’s and 1’s in C++
- Construct a DFA recognizing the language {x | the number of 1's is divisible by 2, and 0'sby 3} over an alphabet ∑={0,1}
- Find the number of integers from 1 to n which contains digits 0’s and 1’s only in C++
- C++ Largest Subtree having Equal No of 1's and 0's
- Sort an arrays of 0’s, 1’s and 2’s using C++
- Sort an arrays of 0’s, 1’s and 2’s using Java

Advertisements