Level_2_Theory_of_Computation_COMP2181WE01_1
Level_2_Theory_of_Computation_COMP2181WE01_1
Duration: 2 hours
Expected form of A SINGLE PDF file (handwritten or typed) submitted onto Gradescope.
Submission
Upload your submission with a file name comprising of your student ID
and the Exam Code e.g 00001234532 COMP2181-WE01.
Submission method Gradescope
Question 1
(c) Suppose that you are given a Turing Machine A, whose language L (A) is
infinite. Describe a Turing Machine B that always terminates and decides
an infinite language L (B) which is a subset of L (A). [6 Marks]
(d) For a fixed tape language, e.g. {0, 1, t}, let f (n) be the maximum number
of steps that any Turing Machine with n states makes before it terminates
when ran on the empty input. Prove that the function f (n) is not com-
putable. [5 Marks]
continued
Page 2 of 5 COMP2181-WE01
Question 2
(a) Design a deterministic Büchi Automaton that recognises the language that
contains the infinite binary words that start with a 1 and have non-empty
finite segments of 0s of even length separated by single 1s. [7 Marks]
(b) For an infinite binary word, consider the sequence of the lengths of its
alternating segments of 0s and 1s. For instance, the sequence for the word
0011101010001 . . . would be 2, 3, 1, 1, 1, 1, 3, . . . . Prove that the language
consisting of all words for which this sequence is strictly increasing is not
recognisable by any Büchi Automaton. [10 Marks]
(c) Evaluate the Computation Tree Logic (CTL) formula A(q U EXp) on all
states of the model below and show all your work. [8 Marks]
r, p p
p p, q q, r
q, r q
p, q, r
Question 3
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]
0 6 4 5 2 0 0 0
0 0 0 0 0 0 4 0
0 1 0 2 0 5 0 0
0 0 0 0 0 0 0 0
2 5 0 1 0 4 0 0
0 0 1 0 0 0 2 0
0 0 0 0 0 0 0 8
0 0 0 0 0 6 0 0
(b) Let G be a graph with n vertices and let k be a positive integer where
n
2
< k ≤ n. Let H be the graph obtained by adding 2k − n vertices (but
no further edges) to G. Show that H contains a clique of size k if and
only if G contains a clique of size k. [2 Marks]
(c) Let G be a graph with n vertices and let k be a positive integer where
k ≤ n2 . Let H be the graph obtained by adding n − 2k vertices to G and
adding edges from each of these new vertices to every other vertex (to
both old and new vertices). Show that H contains a clique of size n − k
if and only if G contains a clique of size k. [7 Marks]
continued
Page 5 of 5 COMP2181-WE01
Clique
Instance: an undirected graph G = (V, E) and an integer k.
Question: does G have a clique containing at least k vertices?
Half Clique
Instance: an undirected graph G = (V, E).
Question: does G have a clique containing exactly half of its
vertices?
It is known that Clique is NP-hard. Using this fact, prove that Half
Clique is NP-hard. [8 Marks]
END OF PAPER