Automata

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

QT. Differentiate NFAand DFA.

which there exists many paths


Ans. NFAor Non-deterministic finite automaton is one in
be used in theory of computatjo
for a specific inpt fromcurrent state to next state. NFA can
DFA.
because they are more flexible and easier to use than
Deterministic finite automaton is a finite automata (EA) in which there is only one path
for a specific input from current state to next state. There is a unique transition on each input
symbol.
2Discuss the concept of regular grammars. /
Ans. Regular grammars : Aregular grammar G=(V.T.P.S) is defined as follows
1. Vis a finite set of variables also called non-terminals. S is the start symbol in y.
2. Tis a finite set of symbols called terminals that form the strings of the languag
generated by the grammar (VnT= 0).
3. Pis afinite set of productions or rewriting rules. Each production is of the form.
A ’ aB, where A,B e V and a e T, ot
A’a, where A E Vanda e T.
(PTU, May 2007)
5. What is Automata? a
Ans. An automaton is an abstract model of a digital computer. An automaton has
mechanism to read input, which is a string over a given alphabet. This input is actually written
on an "Input file"; which can be read by the automaton but cannot change it.
Input File

Storage
Control Unit

Output
Automaton
Input file is divided into cells, each of which can hold one symbol. The automaton hasa
temporary "storage device,which has unlimited number of cells, the contents of which çan
be alteréd by the automaton.Automata has a control unit,which is said to be in one of a finite
number of "internal states". The automaton can change state in a defined way.
Týpes of Automaton : There are two types of automaton :
1. Deterministic automata
2. Non-deterministic automata
à 13. Explain the concept of following :
(a) Transition graph
(b) Transition table
Ans (a) Transition graph :Atransition graph or transition diagram, a inite directe
labeled graph, is a collection of three things:
1. A
finite set of states,_at least one of which is designated the start state and some
which are designated as final states.
2. An alphabet}of possible input symbols from which the input strings are formed
3. A finite set of transition (edge labels) that show the change of state from the give
state on a given input.
Asuccessful path through the transition graph is a series of edges forming a p
beginning at the start state and ending at one of the final states.
Finite Automata
Some of the transition graphs are given below:
States other than final state

Final state

Transition diagram for a DFA

a,b

Here, the transition graph represents a DFA with atleast one a and atleast one b.
A transition diagram for DFA, is a5 tuple M= (Q, , 8, F, go). where :
1. Q, and F are the finite nonempty set of states, the input alphabet and the set of final
states, respectively, as in the case of finite automata;
2. qo E Q and qois non empty; and
3. S is a finite subset of Qx*xQ.
b) Transition table : A transition table is a tabul¡r representation of the transition
function that takes two arguments and returns a state. The column contains the state in
which the automaton willbe on the input represented by that column. The row corresponds to
the state the finite control unit can be in.
Suppose we have a transition function 8(g,a). In transition table row of the table
corresponds to the state q and column corresponding to the input a.
States Input
-b

q1 qo ..
q1 q2
(92 q2
Here the initial state in the table is represented with arrow on that state and the final
state is represented by single circle.
14 the followi NE
Q14. Convert the following NFA to DFA
a,b Qa,b
b b
42

(NFA)
10 LORDS Theory of Computation
Ans. First of all construct a transition table showing all reachable states for every state
for every input signal.
Transition table

State Input
b
qo.41

(NFA)
The set of states resulting from every transition function constitutes anew state. Calculate
allreachable states for every sucth state for every input signal. Repeat this process untillno
more new states are reachable. Now, the final transition table for above NFA is shown in
following figure :
State Input
a b
Start with initial state
[go.4+] [gol (qo.91.92l
Ao.41.92lb Io.42l [Ao.4142l
Stop here as there are [o,42] [9%.41.92l
no more reachable state
DFA
gven hon
Q 40. Write the applications of finite automata.
Ans. Applications of Finite automata : automata. One such example
A. Text editor:Text editors can be constructed using finite
of text editor is MS-Word.
science field is in
we Lexical analyzers:The main use of finite automaton in computer
finite automaton,
compiler design. Lexical analysis is a part of compiler and it is design using
which is known as lexical analyzer. Lexical analyzer is used to recognize the validity of input
analyzer
program, whether the input program is gramatically constructed or not. A lexical
scans the symbol of a program to locate string corresponding to identifiers, constant, etc. and
it has to remember limited amount of information.
3.Spell checkers : Spelling checkers are designed based on finite automata. In general
purpose computer system, there is a word dictionary and finite automata can recognize thè
correctness of a word and give the appropriate suggestion to the user using data from the
dictionary.
odesign finite state machines such as Moore and Mealy machines.
5. Design and analysis of Complex software and hardware systems.
aAns. Write the difference between DFÀ and NFA. C
Difference between DFA and NFA :
DFA NFA DEA
1 OFA" stands for "Deterministic finite "NFA" stands for "Non-deterministic
automata". finite automata".
2 Pormally, an automaton is made up of: 2 An NFA accepts aword if there exist a
<sigma, Q, qo. delta, F> where delta is run of the automaton on it (intuitively,
the transition function. In a DFA, delta the automaton guesses an accepting
takes as input a state and letter and run).
returns only one state. A DFA has only one run on-every word
and therefore accept a word iff the
single run on it is accepting.
3 When processing a string in a DFA, In an NFA, several choice (or no choice)
there is always a unique state to go next may exist for the next state. Can move
when each character is read. It is to more than one states, or no where.
because for each state in DFA, there is Can move to a state without reading
exactly one state that corresponds to anything.
each character being read.
4. DFA can not use empty string transition.A. NFA can use empty string transition.
5. In DFAwe can not move from one state 5. NFAallows ¬ as the second argument
toanother without consuming a symbol. of the transition function. This means
That means, if we want to move from that the NFA can make a transition
one state to other then we must without consuming an input symbol.
consume a symbol.
For every symbol of the alphabet, there 6. We do not need to specifty how does
is only one state transition in DFA. the NFA react according to some
symbol.
DFA can be understood as one K NFA can be understood as multiple little
machine. machines computing at the same time.
DFA will reject the string if it end atother 8. If all of the branches of NFA dies or
than accepting state. rejects the string, we can say that NFA
reject the string.
is more difficult to construct DFA. ? L9NFA is easier to construct.
0. DFA requires more space. 10 NFA requires less space.

You might also like