- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- 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 Articles
- 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
- Design a DFA of a string with at least two 0’s and at least two 1’s
- Count subarrays with equal number of 1’s and 0’s in C++
- Count number of binary strings of length N having only 0’s and 1’s in C++
- Binary representation of next greater number with same number of 1’s and 0’s in C Program?
- 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}
- Largest number with binary representation is m 1’s and m-1 0’s in C++
- Construct an NFA accepting strings with an even number of 0s or an odd number of 1s
- Design a DFA accepting a language L having number of zeros in multiples of 3
- Find the number of integers from 1 to n which contains digits 0’s and 1’s only in C++
- Count the number of 1’s and 0’s in a binary array using STL in C++
- Maximum length of segments of 0’s and 1’s in C++
- 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