Sie sind auf Seite 1von 8

Master of Computer Application (MCA) Semester V MC0082 THEORY OF COMPUTER SCIENCE 4 Credits (Book ID: B0970) Assignment Set

Set 1 (60 Marks)

1. Prove by the method of mathematical induction that


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

Answer: 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

12 (1 1) 2 1 & right side = 4


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

m 2 (m 1) 2 1 2 ... m 4
3 3 3

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

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

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

2. Prove that the number of vertices of odd degrees is always even.

Answer:

3. Construct a grammer for the language


L = {x/x Answer:{a, b}, the number of as in x is a multiple of 3}

4.Briefly explain in your own words Turing machine model

Answer
Turing Machine Model The Turing machine is a state machine that consists of a finite number of states. Usually, it is said to be in a particular state at any given time and this state can be initial, final or halt. The Turing machine model basically consists of one dimensional tape that is divided into a number of cells. This tape, which is of an indefinite length, is used to accumulate the data inside it. The data stored in the cells of the tape can be read and written by Read/Write (R/W) head whose one end is connected with the tape and the other end is connected with the finite control. The finite control in the Turing machine is just like a buffer that keeps track of the next instruction to be executed. Therefore, the structure of the Turing machine is somewhat similar to the modern computer in which the memory acts as the tape and the processor as the R/W head. In figure (given in 12.2.6), the tape is divided into a number of cells in which data is stored.

However, each cell of the tape can contain only one symbol that is either 0 or 1. The R/W head, connected with the tape is used to examine the value stored in the particular cell. However, at a given time, the R/W head can examine only one cell moving to the left and right of the tape.
The current state of the Turing machine and the symbols stored in the cell help in determining the functions performed by the machine. Turing machine cannot be defined in terms of tape and R/W head. It can only be explained in terms of some mathematical notations. The Turing machine is actually 70 , F), where Q is a set that is used to contain different states of machine.

represents a of blank character that belongs


q0 is the initial state of the Turing machine.

- .

current tape symbol being read. The result is a new state of the control unit, a new tape symbol, which replaces the old one, and a move symbol, L or R. The move symbol indicates whether the read-write head moves left or right one cell after the new symbol has been written on the page. Definition A Turing Machine is said to halt whenever it reaches a configura defined.

5. Define a Pushdown automata and explain its construction. Answer:


Definition

10.2.2 Note The transitions performed by the PDA depends on i) The current state ii) The next input symbol iii) The symbol on top of the stack. 10.2.3 Note The action performed by the machine consists of i) Changing the states from one state to another. ii) Replacing the symbol on the stack.

Initial transition: The initial transition refers to the first move performed when the machine shifts from the initial state to a new state. The machine reads the first symbol from the input string. Since it is the first symbol, the content of the pushdown stack memory is not changed. This initial transition can also be written as a0 b0 w1 0 b1. Here, b0 initial state of the machine and b1 refers to the new state obtained while reading the first symbol w1 of the input string. Initially the pushdown store is empty and represented by a0 that appears at the top of the stack. Push transition: The push transition, also called read transition, refers to the move in which the PDA shifts from the current state to a new state and pushes the label of its old state into the stack while reading input symbol. It can be represented as ai bi wj i bj. Here, bi refers to current state, bj refers to the new state of PDA and wj is the input symbol. During transition bi is pushed at the top of the pushdown store Pop transition: The pop transition, also known as lambda transition, refers to the transition process in which the PDA moves from the current state to a new state without reading any input symbol. It can be represented as ai bi j bj. Here, ai is the symbol at the top of the stack with the current state bi, whereas aj refers to the new symbol at the top of the stack when the PDA moves to its new state bj.

Construction of Pushdown Automata There are two cases wherein a string w is accepted by a PDA. state.

In the first case, we say that the language is accepted by a final state and in the second case we say that the language is accepted by an empty stack or null stack. The formal definitions to accept the string by a final state and by an empty stack are defined as follows: Definition

6. Explain Backus Naur Form


Answer:

Backus Naur Form

Das könnte Ihnen auch gefallen