Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Kampala University

UNIVERSITY EXAMINATIONS

END OF SEMESTER EXAMINATIONS

NOVEMBER - DECEMBER, 2022

SCHOOL : COMPUTER SCIENCE AND INFORMATION TECHNOLOGY

PAPER : DESIGN AND ANALYSIS OF ALOGARITHM

CODE : BCIT 2204

DURATION : 3 HOURS

DATE : 29/11/2022 AFTERNOON

INSTRUCTIONS

 DO NOT OPEN THIS QUESTION PAPER UNTIL YOU ARE TOLD TO DO SO.

 Read the instructions carefully on the cover of this question paper

 Attempt any Five questions

 Each question carries 20 marks

 Do not write anything on the question paper

1
QUESTION ONE

a) Before we write algorithm, some times better to be by drawing a flow chart.


i. What do you understand by the term flow chart? (2 Marks)
ii. Explain the different symbols used on a flowchart you know (6 Marks)
b) Give an account of the following methods as used in computing. (3 marks @)
i. Finding GCD
ii. Divide and conquer
iii. Bubble sort
iv. Depth first search traversal (DFS)

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

a) Identity the type of graph above. (1 Marks)


b) Show how the graph above can be represented using an adjacency list and adjacency matrix.
(7 Marks)
c) Carryout the depth first search (DFS) and Breadth first search (BFS) of the graph above.
(9 Marks)
d) Outline the applications where graphs are used in the context of Algorithm. (3 Marks)

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

a) Write an algorithm for finding the minimum element in an array. (5 Marks)


b) Use Strassen’s Matrix multiplication algorithm to multiply (7 Marks)

X= [ ]
3 2
4 8
and Y = [ ]
1 5
9 6

c) Define the following (2 Marks @)


i. One-Dimensional Array

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

You might also like