Sei sulla pagina 1di 10

Master of Computer Application (MCA) Semester 5 MC0082 Theory of Computer Science

Assignment Set 1

ue1! "ro#e $y the principle of mathematical in%uction that


13 + 2 3 + 3 3 + ........ + n 3 = n 2 (n + 1) 2 4

13 + 2 3 + ... + n 3 =

n 2 ( n + 1) 2 4

Base Step: Let n=0 then the sum of the left side is 0 Since there is nothing to add the expression on the right side is also 0 If n=1 then left side is 1 & right side =
12 (1 + 1) 2 =1 4

Hence the result is true for n=1 Induction Hypothesis: Assume that the result to e true for n=m then
13 + 2 3 + ... + m 3 = m 2 (m + 1) 2 4

Adding the !m"1#th term i$e !m"1#% to oth side of the a o&e e'uation
13 + 2 3 + ... + m 3 + ( m + 1) 3 = = = m 2 ( m + 1) 2 + (m + 1) 3 4 ( m + 1) 2 {m 2 + 4( m + 1)} 4 ( m + 1) 2 {m 2 + 4m + 4} 4 ( m + 1) 2 (m + 2) 2 4

( m + 1) 2 ( m + 2) 2 4

(here for the result is true for n=m"1$ Hence the mathematical induction) the gi&en result is true for all positi&e integer n$

ue 2! Construct a grammer for the language L = {x/x{a, b}, the num$er of as in x is a multiple of &'
Ans()

&! "ro#e that the sum of the %egrees of the #ertices of a graph * is t+ice the num$er of e%ges ! Ans(
Let * is a connected graph$ If * has no circuit) then * is a spanning tree$ If * has a circuit) then delete an edge from this circuit$ If till lea&es the graph connected$ If there are more circuits) repeat the operation till an edge from the last circuit is deleted) Lea&ing the graph connected) circuit less and contain all the &ertices of * thus the su graph o tained a spanning tree of *$ Hence e&ery connected graph has at least one spanning tree$ (hen a graph * is connected if and only if it has a spanning tree is ture$

ue!,! -$tain a ./A to accept strings of a0s an% b0s starting +ith the string ab! Ans()
Solution( It is clear that the string should start +ith ab and so) the minimum string that can e accepted y the machine is ab$ (o accept the string a ) +e need three states and the machine can e +ritten as

+here ', is the final or accepting state$ In state '0) if the input sym ol is b) the machine should re-ect b !note that the string should start +ith a#$ So) in state '0) on input b) +e enter into the re-ecting state '%$ (he machine for this can e of the form

(he machine +ill e in state '1) if the first input sym ol is a$ If this a is follo+ed y another a) the string aa should e re-ected y the machine$ So) in state '1) if the input sym ol is a) +e re-ect it and enter into '% +hich is the re-ecting state$ (he machine for this can e of the form .

/hene&er the string is not starting +ith ab) the machine +ill e in state '% +hich is the re-ecting state$ So) in state '%) if the input string consists of as and bs of any length) the entire string can e re-ected and can stay in state '% only$ (he resulting machine can e of the form .

(he machine +ill e in state ',) if the input string starts +ith ab$ After the string ab) the string containing any com ination of as and bs) can e accepted and so remain in state ', only$ (he complete machine to accept the strings of as and bs starting +ith the string ab is sho+n in figure a o&e$ (he state '% is called trap state or rejecting state$

In the set notation) the language accepted y 01A can e represented as L = 2ab!a " b#n n 03 4r L = 2ab!a " b#53 (herefore) the 01A +hich accepts strings of as and bs starting +ith the string a is gi&en y 6 = !7) ) ) '0) 1#) +here 5

7 = 2'0) '1) ',) '%3) = 2a, b3) '0: initial state) 1 = 2',3) and the transition function is defined as

To accept the string a$a$( (he string is accepted y the machine$

(herefore) the string aabb is not accepted y the machine$

ue5! 1rite $riefly a$out the concept of .eterministic /inite Automata (./A) !

Ans()
A 01A is a 89tuple or 'uintuple 6=!7) :) ) '0) 1# 7 is non9empty) finite set of states$ : is non9empty) finite state set of input alpha et$

is transition function) +hich is mapping from 7 ; : to 7$ for this transition


function the parameters to e passed are state and input sym ols$ Based on the current state and input sym ols) the machine may enter into another state$ '0 7 is the start state$ 1 7 is a set of accepting or final state$

2ote: for each input sym ol a) from a gi&en state there is exactly one transition and +e are sure to +hich state the machine enters$ So the machine is called 0eterministic 6achine$

ue3! Con#ert the Moore machine M1 +hose state ta$le is gi#en in ta$le $elo+ into an e4ui#alent Mealy machine
<resent State '0 '1 ', '% mar>s Con#ersion of Mealy Machine into Moore Machine( ?onsider the follo+ing steps Step 1( 1or a state 'i determine the num er of outputs that are a&aila le in @ state ta le of the 6ealy machine$ Step 2( If the outputs corresponding to state 'i in the next state columns are same) then retain state 'i as it is$ Alse) rea> 'i into different states +ith the num er of ne+ states eing e'ual to the num er of different outputs of 'i$ Step &( Bearrange the states and outputs in the format of 6oore machine$ (he common output of the ne+ state ta le can e determined y examining the outputs under the next state columns of the 6ealy machine$ Step ,( If the output in the constructed state ta le corresponding to the initial state is 1) then this specifies the acceptance of the null string C y 6ealy machine$ Hence) to ma>e oth the 6ealy and 6oore machines e'ui&alent) +e either need to ignore the corresponding to null string or +e need to insert a ne+ initial state at eginning +hose output os 0D the other ro+ elements in this case +ould remain the same$ 9 6oore 6achine =ext state Input a = 0 Input a =1 '1 ', '% ', ', '1 '0 '% 4utput 1 0 1 1 10

10

Potrebbero piacerti anche