MC0082 Spring 2013 Assignment

10
Master of Computer Applications Sikkim Manipal University Directorate of Distance Education Assignment Name : Registration No. : Learning Center : Learning Center Code : Course : MCA Subject : MC0082 – Theory of Computer Science Semester : V Semester Module No. : B0970 Date of submission : Marks awarded : Directorate of Distance Education Sikkim Manipal University II Floor, Syndicate House Manipal – 576104 ___________________ _ _________________ ___ ________________ ____ Signature of Coordinator Signature of Center Signature of Evaluator Gaurav Singh Jantwal ROLLNUMBER

description

SMUDE Spring 2013 MC0082 Theory of Computer Science V / 5th Semester

Transcript of MC0082 Spring 2013 Assignment

Page 1: MC0082 Spring 2013 Assignment

Master of Computer Applications Sikkim Manipal UniversityDirectorate of Distance Education

Assignment

Name :

Registration No. :

Learning Center :

Learning Center Code :

Course : MCA

Subject : MC0082 – Theory of Computer Science

Semester : V Semester

Module No. : B0970

Date of submission :

Marks awarded :

Directorate of Distance EducationSikkim Manipal UniversityII Floor, Syndicate House

Manipal – 576104

____________________ ____________________ ____________________Signature of Coordinator Signature of Center Signature of Evaluator

Gaurav Singh Jantwal ROLLNUMBER

Page 2: MC0082 Spring 2013 Assignment

Master of Computer Applications Sikkim Manipal UniversityDirectorate of Distance Education

Comments by the Subject Evaluator:

____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Suggestions for improvement:

____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Gaurav Singh Jantwal ROLLNUMBER

Page 3: MC0082 Spring 2013 Assignment

Master of Computer Applications Sikkim Manipal UniversityDirectorate of Distance Education

1. Define the concept of equivalence relation. Give at least two examples of equivalence relation.

Answer 1: Definition: A relation R on a set A is an equivalence relation if and only if R is

Reflexive, Symmetric Transitive

The definition is motivated by observing that any process of “identification” must behave somewhat like the equality relation, and the equality relation satisfies the reflexive (x = x for all x), symmetric (x = y implies y = x), and transitive (x = y and y = z implies x = z) properties.

Example:I. Let R be the relation on the set R real numbers defined by xRy iff x − y is an integer. Prove that R is an equivalence relation

on R.Proof:

a. Reflexive: Suppose x ∈ R. Then x − x = 0, which is an integer. Thus, xRx.

b. Symmetric: Suppose x, y ∈ R and xRy. Then x − y is an integer.Since y − x = −(x − y), y − x is also an integer. Thus, yRx.

c. Transitive: Suppose x, y ∈ R, xRy and yRz.Then x − y and y − z are integers.Thus, the sum (x − y) + (y − z) = x − z is also an integer, and so xRz.

Thus, R is an equivalence relation on R. #

II. Let R be the relation on the set of real numbers Prove that if xRx ' and yRy' , then (x + y)R(x' + y'). Proof: Suppose xRx ' and yRy '.In order to show that (x + y) R (x’ + y'), we must show that (x + y) − (x ' + y') is an integer.Since (x + y) − (x'+ y') = (x − x') + (y − y'), and since each of x−x ' and y −y ' is an integer (by definition of R), (x−x') + (y −y ') is an integer.Thus, (x + y) R (x ' + y').

Gaurav Singh Jantwal ROLLNUMBER

Page 4: MC0082 Spring 2013 Assignment

Master of Computer Applications Sikkim Manipal UniversityDirectorate of Distance Education

2. Prove by the method of mathematical induction that

13+23+. ..+n3=n2⋅(n+1)2

4Answer 2:

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

4=1

Hence the result is true for n = 1

Induction Hypothesis:Assume that the result to be true for n=m then

13+23+. ..+m3=m2⋅(m+1 )2

4Adding the (m + 1)th term i.e. (m + 1)3 to both side of the above equation

13+23+. ..+m3+(m+1)3=m2⋅(m+1)2

4+(m+1 )3

=

(m+1 )2

4{m2+4(m+1 )}

=

(m+1 )2

4{m2+4m+4 }

=

(m+1 )2

4(m+2)2

=

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

4There for the result is true for n = m + 1. Hence the mathematical induction, the given result is true for all positive integer n.

Gaurav Singh Jantwal ROLLNUMBER

Page 5: MC0082 Spring 2013 Assignment

Master of Computer Applications Sikkim Manipal UniversityDirectorate of Distance Education

3. Prove that a graph G is connected if and only if it has a spanning tree.

Answer 3:

Proof:i. Let G be a connected graph.

ii. If G has no circuit, then G is a spanning tree.iii. If G has a circuit, then delete an edge from this circuit. If till leaves the graph connected.iv. If there are more circuits, repeat the operation till an edge from the last circuit is deleted, leaving the graph connected,

circuit-less, and contains all the vertices of G.Thus the sub-graph obtained is a spanning tree of G.

Hence every connected graph has at least one spanning tree.

Gaurav Singh Jantwal ROLLNUMBER

Page 6: MC0082 Spring 2013 Assignment

Master of Computer Applications Sikkim Manipal UniversityDirectorate of Distance Education

4. Prove that the relation “a≡b (modm)” is an equivalence relation. Answer 4:

Consider relation a≡b(mod m )defined above is an equivalence relation on Z.

Let a € Z.

Reflexive:

Since m divides a – a = 0, we have a≡a mod mSymmetric:

Let a≡b(modm )

⇒ m divides a - b

⇒ m divides –(a - b)

⇒ m divides b - a

⇒ b≡a(modm )

Transitivity:

Let a, b, c Z such thata≡b(mod m ) ,b≡c(mod m )⇒ m divides a - b, and n divides b - c

⇒ m divides (a - b) + (b - c)

⇒ m divides a-c

⇒ b≡c(mod m )

Hence the relation is an equivalence relation.

Gaurav Singh Jantwal ROLLNUMBER

Page 7: MC0082 Spring 2013 Assignment

Master of Computer Applications Sikkim Manipal UniversityDirectorate of Distance Education

5. Explain the concept of a Transition graph.

Answer 5:

Transition System (Transition graph):A finite directed labeled graph in which each node or vertex of the graph represents a state and the directed edges from

one node to another represent transition of a state. All the edges of the transition graph are labeled as input/output. For example, an edge labeled 1/0 specifies that for a certain initial state if the input is 1, then the output is 0.

Consider the following diagram:

In the transition graph as shown in the figure, The initial state, q0, of the system is represented by a circle with an arrow pointing towards it. The final state, q1, is represented by two concentric circles. The directed edges from the initial state to the final state are labeled as input/output.

6. Explain the steps of conversion of Mealy machine into Moore machine.

Gaurav Singh Jantwal ROLLNUMBER

Page 8: MC0082 Spring 2013 Assignment

Master of Computer Applications Sikkim Manipal UniversityDirectorate of Distance Education

Answer 6:

Conversion of Mealy machine into Moore Machine

Consider the following steps

Step 1: For a state qi determine the number of different outputs that are available in th state table of the Mealy machine.

Step 2: If the outputs corresponding to state qi in the next state columns are same, then retain state qi as it is. Else, break qi into different states with the number of new states being equal to the number of different outputs of qi.

Step 3: Rearrange the states and outputs in the format of a Moore machine. The common output of the new state table can be determined by examining the outputs under the next state columns of the original Mealy machine.

Step 4: If the output in the constructed state table corresponding to the initial state is 1, then this specifies the acceptance of null string by Mealy machine. Hence to make both the Mealy and Moore machines equivalent, we either need to ignore the output corresponding to the null string or we need to insert a new initial state at the beginning whose output is 0; the other row elements in this case would remain the same.

Gaurav Singh Jantwal ROLLNUMBER