You are on page 1of 5

GREAT ZIMBABWE UNIVERSITY

FACULTY OF COMMERCE

DEPARTMENT OF ACCOUNTING AND INFORMATION SYSTEMS

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

1. ANSWER ANY FIVE(5) QUESTIONS

2. START EACH ANSWER ON A FRESH PAGE

3. SHOW ALL WORKINGS, WHERE APPLICABLE


QUESTION 1
(a) Describe the following algorithm design techniques

(i) Greedy [2 marks]

(ii) backtracking [3 marks]

(iii) dynamic programming [3 marks]

(b) Highlight similarities and differences between

(i) Greedy and backtracking [4 marks]

(ii) Greedy and dynamic programming [4 marks]

(iii) Backtracking and dynamic programming. [4 marks]

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]

(c) Assuming p= “xyz” and t= “abcdxtanxyt” show how the algorithm

(i) produced in (a) works.

(ii) produced in (b) works, assuming q= 2/3. [6 marks]

(d) Which algorithm, (a) or (b), arrives at a solution faster? Explain briefly. [4 marks]

Page 2 of 5
QUESTION 3

Given an array a[] of N distinct integers,

(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]

(b) Is your algorithm optimal? Fully justify your answer. [6 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]

(c) Explain the concepts of asymptotic time analysis. [2 marks]

(d) Clearly differentiate worst-case, average-case and best-case time complexity.


[6 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]

(i) Selection sort

Page 3 of 5
(ii) Merge sort

(iii) Quicksort [15 marks]

(b) Provide an analysis of the most effective algorithm using the results in (a). [5
marks]

QUESTION 6

(a) Describe how the concept of randomization speeds up computation. [3 marks]

(b) Describe the following randomization techniques:

(i) Numerical

(ii) Las Vegas

(iii) Monte Carlo [6 marks]

(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

(a) Differentiate the following classes of computational problems: P and NP.


[4 marks]

(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.

(i) Explain the concept of NP-completeness. [2 marks]

(ii) Describe how you would show that a problem is NP-complete.


[5 marks]

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.

(i) Explain the disadvantages of using approximation algorithms. [2 marks]

(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

You might also like