0% found this document useful (0 votes)
12 views

Spring 2021 - CS701 - 3

VU CS701 Mid term Assignment

Uploaded by

Areeshy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Spring 2021 - CS701 - 3

VU CS701 Mid term Assignment

Uploaded by

Areeshy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS701 Theory of Computation

Special Assignment (Mid Term)

Total Marks: 50
Due Date: 21-06-2021

Question 1 (7+8=15 Marks)

a) Make a Turing machine that takes any binary string as input and inverts its odd position bits in
the output.

E.g. 1101001  0111100


101010  000000
111111 010101

b) Consider the following Turing machine M

What output it writes on the tape when the input string is


I. 110
II. 111
III. 1000
IV. 1010

What function M is performing on the binary numbers?


Question 2 (3+12=15 Marks)

Following functions are the time complexities of three pairs of algorithms.

1) Algo A : f(n)= 2n2, Algo B: f(n) = 100 nlogn


2) Algo A : f(n)= n5 , Algo B :f(n)= 2n
3) Algo A : f(n)=5n , Algo B : f(n)=500logn

a) For each pair, which algorithm is asymptotically more efficient?.


b) For each pair, whats the minimum value of n at which the asymptotically efficient algorithm
runs faster then the asymptotically slower algorithm. For log, assume base 2 and use ceiling
function to round decimal values (at time of applying log).

Question 3 (4+3+3=10 Marks)

For each statement find the value of X and also give reason why

a) Among binary strings of length 7 there are atleast X strings that are 2-incompressible.

b) Among binary strings of length 8 there are atleast X strings are 4-incompressible.

c) Among binary strings of length 6 there is atleast X strings that are 3-incompressible

Question 4 (5+5=10 Marks)

Consider the following algorithm that determines if a given number n is composite or not

on input <n>

for i = 2..n

check if i divides n

if it does accept

reject

a) The loop runs n times so why this algorithm is not polynomial time in the size of input?.
b) How can a nondeterministic TM decide this problem(composite number) in polynomial time?
Can we use that nondeterministic TM polynomial time algorithm to solve this problem in
polynomial time on a computer. If not why?

You might also like