联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> OS作业OS作业

日期:2024-07-10 04:40

COMP2181-WE01

Theory of Computation

2023

Section A Models of Computation

Question 1

(a) For an infinite binary word, call a ”segment” the alternating contigu-ous sub-words of identical symbols, 0’s or 1’s. For instance, the word 00111010110001 . . . has segments 00, 111, 0, 1, 0, 11, 000, 1 . . . . Consider the following ω-languages.

A = {w|w has segments of even length only} ,

B = {w|w has no segment of odd length} , and

C = {w|w has infinitely many segments,

at least two of which having the same length} .

i. Design B¨uchi automata for A and B. [7 Marks]

ii. What is the relation between A and B? [2 Marks]

iii. Prove that C is not ω-regular. [8 Marks]

(b) Evaluate the Computation Tree Logic (CTL) formula A(p U EXr) on all states of the model below and show all your work. [8 Marks]

Question 2

(a) Construct a single-tape Turing Machine (TM) that, on input consisting of a number of binary strings separated by (a special symbol) #, decides if there are two identical strings or not.

There is no need to give the precise transition function - you should explain how the machine works in plain English.

Give the time-complexity of your TM, i.e. an upper bound on the number of steps it takes in terms of the input length. [10 Marks]

(b) Consider a single-tape TM with two heads that can move right or stay in place (but cannot move left); initially, the first head points to the beginning of the input, while the second head points to the end. Prove that this kind of TM can simulate a standard TM. [8 Marks]

(c) Let a TM A be given which is a decider, i.e. terminates on every input. Consider the question of whether A accepts all inputs. What is the com-plexity of this question when compared, e.g. with the Halting Problem? Explain your reasoning. [7 Marks]

Section B Algorithms and Complexity I

Question 3

(a) Consider the fractional knapsack problem with weight limit W = 82 kilo-grams and five items whose value vi in euros and weight wi in kilograms is given for 1 ≤ i ≤ 6 as follows:

v1 = 48, w1 = 40

v2 = 48, w2 = 12

v3 = 32, w3 = 16

v4 = 45, w4 = 30

v5 = 60, w5 = 20

v6 = 30, w6 = 24.

Solve it using a greedy algorithm. Show all your work. [9 Marks]

(b) i. Recall that two n × n matrices can be multiplied using Strassen’s algorithm in O(n log2 7 ) time. How quickly can you multiply an n×kn matrix A with a kn × n matrix B, using Strassen’s algorithm as a subroutine? Justify your answer. [4 Marks]

ii. Professor Zweistein developed a matrix-multiplication algorithm which uses the divide-and-conquer method. Her algorithm divides each ma-trix into pieces of size n 3/n × 3/n, and the steps divide and combine take together Θ(n 2 ) time. What is the greatest number of subproblems that her algorithm creates at every iteration, in order to be asymp-totically faster than Strassen’s algorithm? [4 Marks]

(c) The Cograph Independent Set problem is as follows:

Cograph Independent Set

Instance: a connected cograph G = (V, E).

Task: compute the independence number α(G) in G, i.e. the size of a largest subset S ⊆ V of vertices which does not induce any edge in G.

Give a polynomial-time algorithm for Cograph Independent Set. [8 Marks]

Section C Algorithms and Complexity II

Question 4

(a) The output of Dijkstra’s algorithm is two arrays d and π, where d records the distance from the source vertex to the other vertices and π records predecessors. Compute d and π when Dijkstra’s algorithm is performed on the weighted directed graph G represented by the adjacency matrix below, where the source vertex corresponds to the first row and first column of the matrix. [8 Marks]

(b) Consider the following flow network with source s and sink t, where each edge is marked with its capacity:

i. What is the value of a maximum flow in this network? Justify your answer using the Max-Flow Min-Cut theorem. [6 Marks]

ii. After how many flow augmentations does the Edmonds-Karp al-gorithm compute the maximum flow from s to t in this network? [3 Marks]

(c) Recall the definition of the decision problem Colouring:

Colouring

Instance: an undirected graph G and an integer k.

Question: is it possible to assign k different colours to the ver-tices of G such that every vertex is assigned exactly one colour and any two adjacent vertices are assigned different colours?

Consider the following decision problem:

Clique Partition

Instance: an undirected graph G = (V, E) and an integer k.

Question: can we partition V into at most k subsets such that each of these subsets is a complete graph?

Provide a polynomial-time reduction from Colouring to Clique Par-tition.   [8 Marks]





版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp