Download DUBLIN CITY UNIVERSITY

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Turing machine wikipedia , lookup

Computational complexity theory wikipedia , lookup

Algorithm characterizations wikipedia , lookup

Corecursion wikipedia , lookup

Busy beaver wikipedia , lookup

History of the Church–Turing thesis wikipedia , lookup

Transcript
DUBLIN CITY UNIVERSITY
SEMESTER ONE RESIT EXAMINATIONS 2012
MODULE:
(Title & Code)
CA320 Computability & Complexity
COURSE:
BSc. in Computer Applications (SE Stream)
YEAR:
3
EXAMINERS:
(Including Telephone Nos.)
Dr. J. Power,
Dr. F. Bannister,
Dr. D. Sinclair, Ext no. 5510.
TIME ALLOWED:
2 hours
INSTRUCTIONS:
Answer 4 Questions.
At least 1 question must be from Section A.
All questions carry equal marks.
Please do not turn over this page until instructed to do so
The use of programmable or text storing calculators is expressly forbidden.
Please note that where a candidate answers more than the required number of
questions, the examiner will mark all questions attempted and then select the highest
scoring ones
Module Code: CA320
Semester One Resit Examinations 2012
PAGE 1 OF 4
Section A
QUESTION 1
[TOTAL MARKS: 25]
1(a)
[5 Marks]
Briefly describe the advantages and disadvantages of functional languages.
1(b)
[10 Marks]
p
The area of a triangle with sides a, b, c id given by s(s − a)(s − b)(s − c) where
s = (a + b + c)/2. Write a Haskel function, with appropriate function type, that
determines the area of a triangle but first check to see if the three side lengths form
a valid triangle.
1(c)
[10 Marks]
Write a function shortest, with appropriate function type, that takes a list of
lists and returns the shortest list in the list (and returns [ ] if the list of lists is empty).
[End of Question 1]
QUESTION 2
[TOTAL MARKS: 25]
2(a)
[5 Marks]
In the context of Haskell, what is meant by list comprehension and give an example
of it.
2(b)
[5 Marks]
A heap is a data structure similar to a binary tree in which the value of the parent
node is greater than the value of its child nodes. Write a data type for a heap.
2(c)
[15 Marks]
The heap condition is true when the value of every node in the heap is greater
than or equal to the value of its children nodes. Write a function in Haskell, with
appropriate function type, that tests if a heap satisfies the heap condition.
[End of Question 2]
Module Code: CA320
Semester One Resit Examinations 2012
PAGE 2 OF 4
Section B
QUESTION 3
[TOTAL MARKS: 25]
3(a)
[5 Marks]
In the study of Computability & Complexity, why do we focus on languages?
3(b)
[5 Marks]
Formally define the set of regular languages.
3(c)
[15 Marks]
Convert the following regular expression into a deterministic finite automaton that
recognises the same language.
(0*|1*)00(0*|1*) | (0*|1*)11(0*|1*)
[End of Question 3]
QUESTION 4
[TOTAL MARKS: 25]
4(a)
[5 Marks]
Formally define a Turing Machine.
4(b)
[10 Marks]
Describe how natural numbers can be represented in a Turing Machine. Design a
Turing Machine that computes the subtraction of two unary number, m and n, where
m > n. Describe the operation of your Turing Machine.
4(c)
[10 Marks]
What is the Church-Turing Thesis? What arguments are there in support of the
Church-Turing Thesis?
[End of Question 4]
QUESTION 5
5(a)
[TOTAL MARKS: 25]
[5 Marks]
Formally describe the Big-O Notation. Rank five typical Big-O categories from
“quickest” to “slowest”.
Module Code: CA320
Semester One Resit Examinations 2012
PAGE 3 OF 4
5(b)
[10 Marks]
In the context of Complexity theory, define the class P. Give an example of a
problem from the class P and prove that the problem is a member of the class P.
5(c)
[10 Marks]
In the context of Complexity, what is meant by polynomial-time reducibility? Prove
that if L1 ∈ P and L1 is polynomially reducible to L2 , then L2 ∈ P .
[End of Question 5]
[END OF EXAM]
Module Code: CA320
Semester One Resit Examinations 2012
PAGE 4 OF 4