Professional Documents
Culture Documents
Design and Analysis of Alogarithm - Regular CW
Design and Analysis of Alogarithm - Regular CW
UNIVERSITY EXAMINATIONS
DURATION : 3 HOURS
INSTRUCTIONS
DO NOT OPEN THIS QUESTION PAPER UNTIL YOU ARE TOLD TO DO SO.
1
QUESTION ONE
QUESTION TWO
a) With examples, define Algorithm. (5 Marks)
b) Describe the characteristics of algorithms (5 Marks)
c) Describe how binary search works and write its algorithm. (10 Marks)
QUESTION THREE
a) The following are array result displayed after sorting and arranging of the Cards by some
computer science students of Kampala University. Study the array and answer the following
questions below
8 2 6 1 5 3
i. Identity one type of sort that is suitable students used? Support your answer.
(6 Marks)
ii. Use the type of sort you identified in (a) above, and sort the array elements above
(8 Marks)
iii. Write its algorithm (6 Marks)
2
QUESTION FOUR
QUESTION FIVE
a) Write a simple program to demonstrate how arrays are used in any language you want
(4 Marks)
b) What are the advantages and disadvantages of using algorithm (8 Marks)
c) Demonstrate with a simple a program on how while loop and Do-While loop are used in
programming? (8 Marks)
QUESTION SIX
X= [ ]
3 2
4 8
and Y = [ ]
1 5
9 6
3
ii. Tree
iii. Stack
iv. Queue
QUESTION SEVEN
a) Explain the difference between space efficiency and Time Efficiency of an algorithm.
(8 Marks)
b) Explain the following and give examples. (4 Marks @)
i. Worst Case Efficiency of an algorithm
ii. Best Case Efficiency of an algorithm
iii. Average case Efficiency of an algorithm
END