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

Assignment Set – 1 (60 Marks)

Ques1. Show that the relationis a ≡ b(mod m ) equivalence relation. Ans.

Ques2. Ans.

Ques3. Prove by the method of contradiction

that is not a rational number.

Ans. A rational number is of the form p/q where , and p, q are not having any common factors. Assume that is a rational number. So it can be written as

If p is even, then it can be written as p = 2k. Therefore 4 = 2 . Therefore q is even. This is a contradiction to our assumption that p and q have no common factors. Therefore rational number. Ques.4. Prove by mathematical induction

is not a

Ans. (i) Base Step: Let n = 0. Then the sum on the left is zero, since there is nothing to add. The expression on the right is also zero. If n=1, left side = Right side = =1 = = 1.

Hence the result is true for n = 1. (ii) Induction Hypothesis: Assume that the result to be true for n = m Then Adding the

th

term i.e.

2

to both sides of the above equation, we get,

=

=

= =

Therefore the result is true for n= m+1. Hence by mathematical induction the given result is true for all positive integers n.

Ques5. Prove that “The sum of the degrees of the vertices of a graph G is twice the number of edges” Ans. (The proof is by induction on the number of edges ‘e‘). Case-(i): Suppose e = 1. Suppose f is the edge in G with f = uv. Then d(v) = 1, d(u) = 1. Therefore

= 2 x (number of edges)

Hence by induction we get that “the sum of the degrees of the vertices of the graph G is twice the numbers of edges”. Ques6. Prove that “T is a tree there is one and only one path between every pair of vertices” Ans. Part 1: Suppose T is a tree. Then T is a connected graph and contains no circuits.

Since T is connected, there exists at least one path between every pair of vertices in T. Suppose that between two vertices a and b of T, there are two distinct paths. Now, the union of these two paths will contain a circuit in T, a contradiction (since T contains no circuits). This shows that there exists one and only one path between a given pair of vertices in T. Part 2: Let G be a graph. Assume that there is one and only one path between every pair of vertices in G. This shows that G is connected. If possible suppose that G contains a circuit. Then there is at least one pair of vertices a, b such that there are two distinct paths between a and b. But this is a contradiction to our assumption. So G contains no circuits. Thus G is a tree.

**February 2011 Bachelor of Computer Application (BCA) – Semester 5 BC0052 – Theory of computer science – 4 Credits
**

Assignment Set – 2 (60 Marks)

Ques1. Prove that “A tree G with n vertices has (n–1) edges”

Ans. We prove this theorem by induction on the number vertices n. Basic step: If n = 1, then G contains only one vertex and no edge. So the number of edges in G is n –1 = 1 – 1 = 0. Induction hypothesis: The statement is true for all trees with less than ‘n’ vertices. Induction step: Now let us consider a tree with ‘n’ vertices. Let ‘ek’ be any edge in T whose end vertices are vi and vj. Since T is a tree, by there is no other path between vI and vj. So by removing ek from T, we get a disconnected graph. Furthermore, T- ek consists of exactly two components (say T1 and T2). Since T is a tree, there were no circuits in T and so there were no circuits in T1 and T2. Therefore T1 and T2 are also trees.

It is clear that |V(T1)| + |V(T2)| = |V(T)| where V(T) denotes the set of vertices in T. Also |V(T1)| and |V(T2)| are less than n. Therefore by the induction hypothesis, we have |E(T1)| = |V(T1)| - 1 and |E(T2)| = |V(T2)| - 1. |E(T1)| = |V(T1)| - 1 and |E(T2)| = |V(T2)| - 1.

. Ques2.If G= ({S}, {0, 1}, { S 0S1, S }, S) , then find L(G), the language generated by G

Ques3. Obtain a DFA to accept strings of a’s and b’s starting with the string ab. Ans. It is clear that the string should start with ab and so, the minimum string that can be accepted by the machine is ab. To accept the string ab, we need three states and the machine can be written as

where q2 is the final or accepting state. In state q0, if the input symbol is b, the machine should reject b (note that the string should start with a). So, in state q0, on input b, we enter into the rejecting state q3. The machine for this can be of the form

The machine will be in state q1, if the first input symbol is a. If this a is followed by another a, the string aa should be rejected by the machine. So, in state q1, if the input symbol is a, we reject it and enter into q3 which is the rejecting state. The machine for this can be of the form

Whenever the string is not starting with ab, the machine will be in state q3 which is the rejecting state. So, in state q3, if the input string consists of a‟s and b‟s of any length, the entire string can be rejected and can stay in state q3 only. The resulting machine can be of the form

The machine will be in state q2, if the input string starts with ab. After the string ab, the string containing any combination of a‟s and b‟s, can be accepted and so remain in state q2 only. The complete machine to accept the strings of a‟s and b‟s starting with the string ab is shown in figure. The state q3 is called trap state or rejecting state.

In the set notation, the language accepted by DFA can be represented as

L = {ab(a + b) | n 0} Or L = {ab(a + b)*} Therefore the DFA which accepts strings of a‟s and b‟s starting with the string ab is given by M = (Q, , , q0, F), where Q = {q0, q1, q2, q3}, = {a, b}, q0: initial state, F = {q2}, and the transition function is defined as

n

To accept the string abab: The string is accepted by the machine.

To reject the string aabb:

Therefore the string aabb is not accepted by the machine. Ques4. Briefly describe Moore and Mealy machines.

Ans. The automation systems we have discussed so far are limited to binary output. That is, the systems can either accept or do not accept a string. In those systems, this acceptability is decided based on the reachability from the initial state to the final state. This property of the system produces restrictions in choosing outputs from some other alphabet, then output. You can remove this constraint using both the Moore and Mealy machine, which help in generating an output from a certain output alphabet. Let us denote the output function with the symbol . Thus, when the output of an automation system is dependent only on the present state, then, Output = (q(t)), where q(t) is the present state. The above automaton system is called a Moore machine. Alternatively, when the output of the automaton system is dependent on both the present input and the present state, then, Output = (q(t), x(t)), where q(t) is the present state and x(t) is the present input. The above automaton system is called a Mealy machine. Since the output of a Mealy machine is dependent on both the input and the present state, no output is generated when the input is a null string. This implies that when the input is , the output is also . However, in case of the Moore machine, there is some output of the Moore machine which is only dependent on the present state and not on the present input. Hence, when the input to a Moore machine is , the output is (q0). Ques5.

Ans. i) Consider the string: aaab

Therefore the string „aaab’ is not accepted by M.

ii) Consider the string: bbaa

Therefore „bbaa’ is not accepted by M. iii) State diagram:

Ques6. Obtain a regular expression such that L(R) = {w | w 0‟s.

{0, 1}* with at least three consecutive

Ans. string consisting of 0‟s and l‟s can be represented by the regular expression (0 + 1)* This arbitrary string can precede three consecutive zeros and can follow three consecutive zeros. Therefore the regular expression can be written as (0 +1)* 000(0+1)*. The language corresponding to the regular expression can be written as n L(R) = { (0 + 1)m000(0+1) | m 0 and n 0}.

Sikkim Manipal University BCA 5th sem Assignment.

Sikkim Manipal University BCA 5th sem Assignment.

- SMU BCA 5th Sem 2011 VB.Net And Xml
- SMU BCA 5th Sm 2011 Tcp Ip Protocol Suite
- SMU BCA 5th sem Software Project Management & Quality Assurance
- SMU BCA 5th sem 2011 Unix
- BC0056 - (solved) Unix Operating System
- BC0054 – Software project Management & Quality Assurance
- Solved, BC0052 Spring Drive Assignment
- BC0054 - (solved) Software Quality Management(2012)
- BC0053- (solved) Vb.net(2012)
- BC0056 Assignment Spring 2013
- Bc0053 Vb.net & XML
- BC0053-Fall Drive Assignments 2012
- BC0052 Assignment
- BC0052 Assignment 2
- 20628549 Linux Commands
- BC0052 Theory of Computer Science
- vb
- BC0052 - Theory of Computer Science Set-1.docx
- Unix
- Assingment Solved Bc0056
- BC0056-Fall Drive Assignments 2012
- BC0054-Fall Drive Assignments 2012
- BC0053 Assingment 1
- BC0057-Object Oriented Analysis & Design
- Bc 0058
- Artificial Intelligence
- BC0057
- BC0052 Theory of Computer Science Fall 10
- SMU BCA 5th Sem 2011 Unix
- BC0052 Assignment Spring 2013

Are you sure?

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

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd