Professional Documents
Culture Documents
FACULTY OF COMMERCE
EXAMINATION
______________________________________________________________________
MASTER OF COMMERCE IN INFORMATION SYSTEMS PART 1 SEMESTER 2
DESIGN AND ANALYSIS OF ALGORITHMS MIS511
DATE JUNE 2015
DURATION 3 HOURS
INSTRUCTIONS TO CANDIDATES
QUESTION 2
(a) Give an algorithm for finding an exact string match when searching for a string P
within a text T. [5 marks]
(b) Usually when one is searching for a phrase on the internet, the search engine
produces results in the following manner: exact match, 80%+ partial match, 70-
80% match, etc until it gets to 1-10% match. Modify the algorithm in (a) so that it
accepts a pattern P, a text T and a percentage qualifier q which states the level
of exactness required. The algorithm must then stop when either it has verified
that p does not exist or when q% of p has been found. [5 marks]
(d) Which algorithm, (a) or (b), arrives at a solution faster? Explain briefly. [4 marks]
Page 2 of 5
QUESTION 3
(a) Design an algorithm to find if there exists indices i, j, and k such that (a[i] + a[j] +
a[k] == 0). State the design technique used. [9 marks]
(c) Give the worst case analysis of the algorithm as a recurrence equation. Explain
your answer. [5 marks]
QUESTION 4
Suppose you are given the following expressions for the algorithm efficiency of
algorithms for solving the same problems.
( ) = +2 ( )= + ( log ) ( )= √ +4 ( )= log(log )
(a) Sketch one graph that shows clearly the growth rates of each of the expressions,
making sure to plot for large values of n. [8 marks]
(b) Give a detailed assessment of the most efficient and least efficient expression.
[4 marks]
QUESTION 5
(a) Show how the following algorithms sort the partially sorted array [5, 9, 3, 11, 2, 1,
0, 12, 7, 8, 13, 6]
Page 3 of 5
(ii) Merge sort
(b) Provide an analysis of the most effective algorithm using the results in (a). [5
marks]
QUESTION 6
(i) Numerical
(c) Give the one advantage and one disadvantage of each technique in (b).
[6 marks]
(d) Using a randomization technique of your choice, illustrate how you would
randomize the selection sort algorithm. [5 marks]
QUESTION 7
(b) The travelling salesman problem is described as the problem of finding the
shortest tour that a salesman needs to make through all cities and back. This
problem is described as NP-complete.
Page 4 of 5
(c) Two ways of getting around NP-completeness
NP completeness are to develop an approximation
algorithm or to develop an exponentially running time algorithm for small input
sizes.
(ii) Give an approximation algorithm for the travelling salesman problem and
illustrate how it works on the graph below, assuming that the tour starts at
node 1. [4 + 3 marks]
END OF EXAM
Page 5 of 5