CSC 804
CSC 804
CSC 804
Find:
(i) F (4, 2) (ii) F(1, 5) (iii) F(2, 4)
(iv) When is F(M, N) undefined?
3 (b) Show that the following are recursive
(i) factorial n
ii) Fibonacci (n)
4. (a) Suppose the Alphabet given below represents what constitutes a valid
arithmetic expression that can be typed on one line, in a form digestible by
computers.
∑ = {0 1 2 3 4 5 6 7 8 9 + − ∗ / ( )}
Show whether the following strings are good or not good. Give reasons to
support your answers.
(i) (3 + 5) + 6)
(ii) 2 (/ 8 + 9)
(iii) (3 + (4 -) 8 )
(iv) 2) – ( 4
4 (b) Judging from your answers in 4(a) above, what conclusion could you
make about the natural way of defining a valid arithmetic expression?
5. (i) Why is the use of heuristics desirable?
(ii) Using Towers of Hanoi Puzzle, define what is meant by combinatorial
problem
(iii) Show that the computational complexity of Towers of Hanoi is O(2n)
6. (a) Traveling salesman problem (TSP) is easy to characterise but difficult
to solve. Discuss with emphasis on its:
(i) meaning (ii) graph (iii) solution, using nearest neighbour heuristic
as well as exact algorithm.
(b) List five application areas of TSP
7. Computational problems can be categorised into four. Discuss
8. Explain the concept of divide – and – conquer, and greedy strategies in
algorithm design. Use binary search technique, and knapsack model to
illustrate respectively.
9. Discuss briefly the following data structures
(i) array (ii) linked list (iii) tree
10. Consider the following algorithm
ALGORITHM Enigma ([1. . 𝑛, 1. . 𝑛])
// Input: A Matrix A [1. . 𝑛, 1. . 𝑛] of real numbers
for i =1 to n-1 do
for j = i + 1 to n-1 do
if A [𝑖, 𝑗] <> A [𝑗, 𝑖 ]
return false
return true
(i) What does this algorithm do?
(ii) What is the basic operation?
(iii) How many times is the basic operation executed?
(iv) What is the efficiency of this algorithm?