## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Lecture Notes 5

Conversion of NFA to DFA

**Conversion of NFA to DFA Let M2 = < Q2 , < Q, , q0 , , q2,0 ,
**

2

, A2 > be an NFA that recognizes a language L. Then the DFA M =

, A > that satisfies the following conditions recognizes L:

Q = 2Q2 , that is the set of all subsets of Q2 , q0 = { q2,0 } , ( q, a ) = A={q Q|q A2 for each state q in Q and each symbol a in } and

**To obtain a DFA M = < Q, M2 = < Q2 , , q2,0 ,
**

2

, q0 ,

, A > which accepts the same language as the given NFA

, A2 > does, you may proceed as follows:

Initially Q = . First put { q2,0 } into Q. { q2,0 } is the initial state of the DFA M. Then for each state q in Q do the following: add the set Q for each symbol a in For this new state, add of NFA M2. , where . ( q, a ) = here is that of NFA M2, as a state to Q if it is not already in

to

, where the

on the right hand side is that

When no more new states can be added to Q, the process terminates. All the states of Q that contain accepting states of M2 are accepting states of M. Note: The states that are not reached from the initial state are not included in Q obtained by this procedure. Thus the set of states Q thus obtained is not necessarily equal to 2Q2 .

B Kiran Kumar/GMRIT/CSE

Page 1

b ) = { 1 . a ) = { 1 . 2 } . and 2( 2 .b)= . } . Similarly ( { 1 . 2 } is now in Q. 2 }. Then since { 1 . Since 2( 1 .b)= At this point Q = { {0} . Thus no new states are added to Q . Similarly 2 } . 2 } . B Kiran Kumar/GMRIT/CSE Page 2 . the transitions from { 1 . a ) = { 1 .a)={1.b)= . Thus { 1 . Since the transitions from all states of Q have been computed and no more states are added to Q. a ) = { 1 .2}. Note that there are no states of Q2 in Hence ( .a)= ( . Then since the initial state of the DFA is {0} . { 1 . 3 } . b ) = . Hence there are no states that M2 can go to from . 3 } . Since Since 2 ( 0 . 2 } is added to Q and (0. a ) = . ( { 1 . {0} is added to Q. { 1 . . a ) = { 1 . 3 } is added to Q . 2 } . is added to Q and ({0}. ({1. . the conversion process stops here. 3 } .Compiler Design Unit I Lecture Notes 5 Example 1: Let us convert the following NFA to DFA. 2 } and ( { 1 . 2 } on symbols a and b are computed. 2 ({0}. Initially Q is empty. 2 } .

3 } are the accepting states of M. Example 2: Similarly the NFA B Kiran Kumar/GMRIT/CSE Page 3 . The DFA thus obtained is shown below.Compiler Design Unit I Lecture Notes 5 For the accepting states of M. { 1 . 2 } and { 1 . Hence { 0 }. all the states of Q that contain 0 and/or 1 are accepting states. since states 0 and 1 are the accepting states of the NFA.

Compiler Design Unit I Lecture Notes 5 is converted to the following DFA: B Kiran Kumar/GMRIT/CSE Page 4 .

- Sapiens
- The Unwinding
- Yes Please
- Dispatches from Pluto
- Elon Musk
- The Innovators
- John Adams
- Devil in the Grove
- A Heartbreaking Work Of Staggering Genius
- Grand Pursuit
- This Changes Everything
- The Emperor of All Maladies
- The Prize
- Team of Rivals
- The New Confessions of an Economic Hit Man
- The World Is Flat 3.0
- Rise of ISIS
- Smart People Should Build Things
- The Hard Thing About Hard Things
- How To Win Friends and Influence People
- Angela's Ashes
- Steve Jobs
- Bad Feminist

- The Light Between Oceans
- Leaving Berlin
- The Silver Linings Playbook
- The Sympathizer
- Extremely Loud and Incredibly Close
- You Too Can Have a Body Like Mine
- The Incarnations
- Life of Pi
- The Love Affairs of Nathaniel P.
- A Man Called Ove
- Bel Canto
- The Master
- We Are Not Ourselves
- The First Bad Man
- The Rosie Project
- The Blazing World
- Brooklyn
- The Flamethrowers
- Wolf Hall
- The Art of Racing in the Rain
- The Wallcreeper
- Interpreter of Maladies
- Beautiful Ruins
- The Kitchen House
- The Perks of Being a Wallflower
- The Bonfire of the Vanities
- Lovers at the Chameleon Club, Paris 1932
- A Prayer for Owen Meany
- The Cider House Rules
- Mislaid

Read Free for 30 Days

Cancel anytime.

Close Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading