2.5K views

Uploaded by Ali Asharaf Khan

MC0082 – Theory of Computer Science – 4 Credits

- MC0082
- MC0083
- MC0084 – Software Project Management &
- MC0081
- MC0081 Solved Assignment
- MC0081 – .(DOT) Net Technologies – 4 Credits
- MC0083
- MC0081
- mc0084 set 1 killer assignment spring 2012
- MC0081 set 1 &2 solved assingment 2012
- Solved, MC0082-Winter20Drive20Assignment
- MC0081
- mc0082 set 1 killer assignment 2012
- MC0085 – Advanced Operating Systems
- mc0082 set2 killer assignment 2012
- SMU 5th Sem Aug 2012 Assignment
- Solved, MC0081 Spring Drive Assignment
- MC0083
- mc0083 set2 killer assignment spring 2012
- MC0083 Fall Drive Assignment 2012

You are on page 1of 11

MC0082 – Theory of Computer Science – 4 Credits

(Book ID: B0970)

Assignment Set – 1 (60 Marks)

1. Define the terms: Graph, finite graph, infinite graph, incidence, degree, isolated vertex,

pendent vertex, null graph.

10 marks

{ }

2. Generate the language L (G) = a n b n c n n ≥ 1 by the following grammar.

S → asBC

S → aBC

CB → BC

aB → ab

bB → bb

bC → bc

cC → cc

10 marks

3. Prove that the sum of the degrees of the vertices of a graph G is twice the number of edges

10 marks

4. Obtain a DFA to accept strings of a’s and b’s starting with the string ab.

10 marks

10 marks

6. Convert the Moore machine M1 whose state table is given in table below into an equivalent

Mealy machine

Moore Machine

Next state Output

Present State

Input a = 0 Input a =1

→ q0 q1 q2 1

q1 q3 q2 0

q2 q2 q1 1

q3 q0 q3 1

10 marks

February 2011

Master of Computer Application (MCA) – Semester 5

MC0082 – Theory of Computer Science – 4 Credits

(Book ID: B0970)

Assignment Set – 2 (60 Marks)

1. Prove by mathematical induction that

n(n + 1 ) (2n + 1)

12 + 2 2 + 3 2 + .... + n 2 =

6

10 marks

If L1 and L2 are regular, then the regular language is closed under intersection.

10 marks

{

L = ai b j i , j ≥ 1, i≠j } 10 marks

10 marks

5. State and prove pumping lemma for Context Free Languages

10 marks

6. Find a Turing machine to accept the language containing string’s of 0’s and 1’s ending with

011 10 marks

Assignment Set – 1(ANSWER-1)

Graph theory is the study of graphs, mathematical structures used to model pairwise relations between objects

from a certain collection. A "graph" in this context refers to a collection of vertices or 'nodes' and a collection of

edges that connect pairs of vertices. A graph may be undirected, meaning that there is no distinction between the

two vertices associated with each edge, or its edges may be directed from one vertex to another; see graph

(mathematics) for more detailed definitions and for other variations in the types of graphs that are commonly

considered. The graphs studied in graph theory should not be confused with graphs of functions or other kinds of

graphs.

Graphs are one of the prime objects of study in Discrete Mathematics. Refer to Glossary of graph theory for basic

definitions in graph theory.

A finite graph is a graph G = (V, E) such that V and E are finite sets. An infinite graph is one with an infinite set of

vertices or edges or both.

Most commonly in graph theory it is implied that the graphs discussed are finite. If the graphs are infinite, that is

usually specifically stated.

In graph theory, the degree (or valency) of a vertex of a graph is the number of edges incident to the vertex, with

loops counted twice. The degree of a vertex v is denoted deg(v). The maximum degree of a graph G, denoted by

Δ(G), and the minimum degree of a graph, denoted by δ(G), are the maximum and minimum degree of its vertices.

In the graph on the right, the maximum degree is 3 and the minimum degree is 0. In a regular graph, all degrees

are the same, and so we can speak of the degree of the graph.

In one more generalized notion,E is a set together with a relation of incidence that associates with each edge two

vertices.

An isolated vertex is a vertex with degree zero; that is, a vertex that is not an endpoint of any edge.

A leaf vertex (also pendant vertex) is a vertex with degree one. In a directed graph, one can distinguish the

outdegree (number of outgoing edges) from the indegree (number of incoming edges).

In the mathematical field of graph theory, the null graph or the empty graph is either the graph with no vertices

and (hence) no edges, or any graph with no edges.

The null graph (in the former sense) is the initial object in the category of graphs, according to some definitions of

a category of graphs. Having no vertices, the null graph therefore also has no connected components. Thus,

although the null graph is a forest (a graph with no cycles), it is not a tree, as trees have one connected component.

We generate the language for n = 2. That is, we derive the string a2b2c2.

S ⇒ aSBC

⇒ aaBCBC

⇒ aaBBCC

⇒ aabBCC

⇒ aabbCC

⇒ aabbcC

⇒ aabbcc

If G has no circuit, then G is a spanning tree.

If G has a circuit, then delete an edge from this circuit.

If till leaves the graph connected. If there are more circuits, repeat the operation till an edge from the last circuit is

deleted, Leaving the graph connected, circuit less and contain all the vertices of G thus the sub graph obtained a

spanning tree of G.

Hence every connected graph has at least one spanning tree.

Then a graph G is connected if and only if it has a spanning tree is ture.

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.

Assignment Set – 1(ANSWER-5)

A DFA is a 5-tuple or quintuple M=(Q, ∑, , q0, F)

Q is non-empty, finite set of states.

∑ is non-empty, finite state set of input alphabet.

is transition function, which is mapping from Q X ∑ to Q. for this transition function the parameters to be passed

are state and input symbols. Based on the current state and input symbols, the machine may enter into another

state.

q0 Q is the start state.

F Q is a set of accepting or final state.

Note: for each input symbol a, from a given state there is exactly one transition and we are sure to which state the

machine enters. So the machine is called Deterministic Machine.

Consider the following steps

Step 1: For a state qi determine the number of outputs that are available in θ 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 Moore machine.

The common output of the new state table can be determined by examining the outputs under the next state

columns of the 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 the null string ^ by Mealy machine. Hence, to make both the Mealy and Moore machines equivalent,

we either need to ignore the corresponding to null string or we need to insert a new initial state at beginning whose

output os 0; the other row elements in this case would remain the same.

Let us first transform each column of inputs into the pairs of the next state and the output as shown in the

following table.

Present State Input a = 0 Input a = 1

State Output State Output

q0 q1 0 q2 1

q1 q3 1 q2 1

q2 q2 1 q1 0

q3 q0 1 q3 1

Since there are no two states in the above state table which have identical row elements, the state table as shown

represents the equivalent Mealy machine for the Moore machine depicted above.

Assignment Set – 2(ANSWER-1)

Assignment Set – 2(ANSWER-3)

We decompose where

A → aA

A → aB

B → aBb

B → ab

A is a starting symbol.

Grammar for L2 :

Productions: C → Cb

C → Db

D → aDb

D → ab

Now by adding the two sets of productions, S → A, S → C with S as the starting symbol, we get the grammar

C → Bb.

General Method: Since n number of a s should be followed by n number of b’s, let us push all the symbols on to

the stack as long as the scanned input symbol is ‘a’. Once we encounter b’s, we should see that for each ‘b’ in the

input, there should be corresponding ‘a’ on the stack. When the input pointer reaches the end of the string, the

stack should be empty. If stack is empty, it indicates that the string scanned has n number of a’s followed by n

number of b’s. Step 1: Let q0 be the start and Z0 be the initial symbol the stack. As long as the next input symbol

to the scanned is ‘a’, irrespective of what is there on the stack, keep pushing all the symbols on to the stack and

remain in q0. The transitions defined for this can be of the form

(q0, a, Z0) = (q0, aZ0)

(q0, a, a) = (q0, aa)

Step 2: In state q0, if the next input symbol to be scanned is ‘b’ and if the top of the stack is ‘a’, change the state to

q1 and delete one ‘b’ from the stack. The transition for this can be of the form (q0, b, a) = (q1, )

Step 3: Once the machine is in state q1, the rest of the symbols to be scanned will be only b’s and for each ‘b’

there should be corresponding symbol ‘a’ on the stack. Therefore, as the scanned input symbol is b and if there is a

matching ‘a’ on the stack, remain in q1 and delete the corresponding ‘a’ from the stack. The transitions defined for

this can be of the form

(q1, b, a) = (q1, )

Step 4: In state q1, if the next input symbol to be scanned is and if the top of the stack is Z0, change the state to q2

which is an accepting state. The transition defined for this can be of the form (q1, , Z0) = (q2, Z0)

Statement: Let L be the context free language and is infinite. Let Z be sufficiently long string and z L so that |z| n

where n is some positive integer. If the string z can be decomposed into combination of strings z = uvwxy.

Such that |vwx| n, |vx| 1, then uvi wiy L for i=0,1,2,…….

Proof of Pumping Lemma:

By pumping lemma, it is assumed that string z L is finite and is context free language. We know that z is string of

terminal which is derived by applying series of productions.

Case 1: To generate a sufficient long string z, one or more variables must be recursive. Let us assume that the

language is finite, the grammar has a finite number of variables and each has finite length. The only way to derive

sufficiently long string using such productions is that the grammar should have one or more recursive variables.

Assume that no variable is recursive.

Since no non terminal is recursive, each variable must be defined. Since those variables are also non recursive,

they to be defined in terms of terminal and other variables and so on.

From this we conclude that there is a limit length of the string that is generated from the start symbol S. this

contradicts our assumption that the language is finite.

Therefore, the assumption that one or more variable are non recursive is incorrect.

This means that this means that one or more variable are non recursive and hence the proof.

Case 2: The string z L implies that after applying some / all production some number of times, we get finally

string of terminal and the derivation stops.

Let z L is sufficiently long string and so the derivation must have involved recursive use of some non terminal A

and the derivation must have the form:

*

Note that any derivation should start from the start symbol S.

The DFA which accepts the language consisting of 0 s and 1 s ending with the string 001 is shown

below

01

q0 q1 q0

q1 q1 q2

q2 q1 q3

q3 (final state) q1 q0

For each scanned input symbol (either 0 or 1), in whichever state the DFA was in, TM also

enters into the same states on same input symbols, replacing 0 by 0 and 1 by 1 and the read-

write head moves towards right. Therefore, the transition table for DFA and TM remains same

(the format may be different. It is evident in both the transition tables). So the transition table

for TM recognizes the language consisting of 0 s and 1 s ending with a substring 001

States

01□

q0 q1, 0, R q0, 1, R

q1 q1, 0, R q2, 1, R

q2 q1, 0, R q3, 1, R

q3 q1, 0, L q0, 1, R q4, □, R

q4 - - -

Therefore, the TM to recognize the given language is given by

Q = {q0, q1, q2, q3}

= {0, 1}

= {0, 1, □}, is defined above.

q0 is the start state

□ is the blank character

F = {q4} is the final character

- MC0082Uploaded byPalokaran Joseph Aju
- MC0083Uploaded byPalokaran Joseph Aju
- MC0084 – Software Project Management &Uploaded byAli Asharaf Khan
- MC0081Uploaded byjitendrasain
- MC0081 Solved AssignmentUploaded byNaved Azmi
- MC0081 – .(DOT) Net Technologies – 4 CreditsUploaded byAli Asharaf Khan
- MC0083Uploaded byPriya Sagi
- MC0081Uploaded bytejas1920
- mc0084 set 1 killer assignment spring 2012Uploaded bykiller1
- MC0081 set 1 &2 solved assingment 2012Uploaded bySubhajit Saha
- Solved, MC0082-Winter20Drive20AssignmentUploaded byArvind K
- MC0081Uploaded bymeerasin
- mc0082 set 1 killer assignment 2012Uploaded bykiller1
- MC0085 – Advanced Operating SystemsUploaded byAli Asharaf Khan
- mc0082 set2 killer assignment 2012Uploaded bykiller1
- SMU 5th Sem Aug 2012 AssignmentUploaded byShailendra Kumar
- Solved, MC0081 Spring Drive AssignmentUploaded byArvind K
- MC0083Uploaded byVikas Kumar
- mc0083 set2 killer assignment spring 2012Uploaded bykiller1
- MC0083 Fall Drive Assignment 2012Uploaded bySulendra Kumar
- mc0088 model paperUploaded byBaijnath Gupta
- MC0082 Theory of Computer ScienceUploaded byGaurav Singh Jantwal
- MC0081Uploaded bysamir_sofy
- MC0082Uploaded byrahul_151190
- MC0087 Assignment Spring 2013 solvedUploaded byNaved Azmi
- MC0082 - Theory of Computer scienceUploaded byPurushottam Kumar
- mc0085 set 1 killer assignment spring 2012Uploaded bykiller1
- mc0084 set 2 killer assignment spring 2012Uploaded bykiller1
- Solved, MC0083-Winter0Drive20AssignmentUploaded byArvind K
- MC0081Uploaded bySk Sahani J

- MBA-4 Set-1 MF0015 - International Financial ManagementUploaded byAli Asharaf Khan
- DBMS ConceptsUploaded byAli Asharaf Khan
- MB0040-MBA-1st Sem 2011 Assignment Staistics for ManagmentUploaded byAli Asharaf Khan
- 4th Strategic Management and Business Policy22Uploaded byAli Asharaf Khan
- 2011-SMU- MB0045 –MBA 2nd (Financial Management)Uploaded byAli Asharaf Khan
- MC0081 – .(DOT) Net Technologies – 4 CreditsUploaded byAli Asharaf Khan
- MBA 4th MF0016 – Treasury ManagementUploaded byAli Asharaf Khan
- SAN Interview Question Answers Part-2Uploaded byAli Asharaf Khan
- 2011-SMU-MBA 2nd (Production & Operations Manageme) Set-1Uploaded byAli Asharaf Khan
- MB0039 –MBA-1st Sem 2011 Assignment Business Communication -Part-1Uploaded byAli Asharaf Khan
- 2011-SMU-MBA 2nd (Production & Operations Manageme) Set-2Uploaded byAli Asharaf Khan
- MC0085 – Advanced Operating SystemsUploaded byAli Asharaf Khan
- MB0043-MBA-1st Sem 2011 Assignment Human Resource ManagementUploaded byAli Asharaf Khan
- MB0042-MBA-1st Sem 2011 Assignment Managerial EconomicsUploaded byAli Asharaf Khan
- MB0042 Managerial Economics Assig Set-2Uploaded byAli Asharaf Khan
- MB0025-XUploaded byAli Asharaf Khan
- MB0024Uploaded byAli Asharaf Khan
- MK0009Uploaded byAli Asharaf Khan
- mb0026Uploaded byAli Asharaf Khan
- MB0022Uploaded byAli Asharaf Khan
- MB0027Uploaded byAli Asharaf Khan
- SEM 1 MB0043 2 Human Resource ManagementUploaded byswamy11in
- MB0023Uploaded byAli Asharaf Khan
- ML0007Uploaded byAli Asharaf Khan
- MB0038 –MBA-1st Sem 2011 Assignment Management Process and Organization Behavior Set 1Uploaded byAli Asharaf Khan
- Key - XUploaded byAli Asharaf Khan
- MK0006Uploaded byAli Asharaf Khan
- mk0008Uploaded byAli Asharaf Khan

- Microsoft Exchange 2013 Deployment GuideUploaded byEduardo Gonzalez
- Class 5 IMO 5 Years e Book Level 2 2018Uploaded byNilesh Gupta
- 2017-18 Program of StudiesUploaded byRichard Lester
- Albert - Yanomami ViolenceUploaded byDouglas Ferreira Gadelha Campelo
- Mobile Banking Soft (1)Uploaded byMD. JAHID
- United States v. John W. Downing, 753 F.2d 1224, 3rd Cir. (1985)Uploaded byScribd Government Docs
- SAP Education Schedule_EN (1)Uploaded byAlan Leon
- 100+ Robotics Projects for Final Year Engineering StudentsUploaded byPragathi Reddy
- Signals and Systems Kuestion (EE)- By www.EasyEngineering.net.pdfUploaded bylaxmandasri
- LaunchpadUploaded bycaxap
- Advaita-Vedanta-Eliot-DuetschUploaded byvedasagar
- Kinematics Table Tennis RolUploaded byRolando Nina
- Management Trends June - Dec 2013Uploaded byC. Madhavaiah
- Quality Control in Concrete ConstructionUploaded bySahil Kaushik
- BTEC Command WordsUploaded byJoshKellySwagMaster2
- CANOCOUploaded byMarcelo Bueno
- Kao Optimized Coacervation FormationUploaded byQuỳnh-Mai Nguyễn
- Lessons from Three Decades of Green Revolution.pdfUploaded byrbmalasa
- Java PuzzleUploaded byMarco Mallorquín
- 14 LTE Access Fault DiagnosisUploaded byĐêm Trắng
- Xenius™ 4 EnergyUploaded bymakmohit6037
- OR quizUploaded byMr Nerd
- Why People Use Health Services by Irwin M. RosenstockUploaded byBuyTheBid
- CCode GenerationUploaded byabhishek gera
- JosephMurphyChapter 1Uploaded byEarthula Black
- Policy study on Dipolog City Urban Renewal ProjectUploaded byPaul Anthony Torres
- xftim 0807Uploaded byrstsyn
- Lt SpiceUploaded byKot Fare
- PLC - Micro800 - D&A Expansion IOUploaded byBa Khoa Tran
- Problems to Solve OrUploaded byJoko Tri Rubiyanto