0% found this document useful (0 votes)
52 views3 pages

ICS 2301 Design and Analysis of Algorithms

Uploaded by

lorderoyals7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views3 pages

ICS 2301 Design and Analysis of Algorithms

Uploaded by

lorderoyals7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

W1-2-60-1-6

JOMO KENYATTA UNIVERSITY OF AGRICULTURE AND TECHNOLOGY

SCHOOL OF OPEN, DISTANCE AND ELEARNING

MAIN EXAMINATION 2018

BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

ICS 2301: DESIGN AND ANALYSIS OF ALGORITHMS

DECEMBER 2018 DURATION: 2


HOURS

Instructions: Answer question one and any other two questions

QUESTION 1 (ONE)

a) A good knowledge of algorithm design and analysis form an integral part of computer
science solutions
i. Elucidate the term algorithm
(2marks)
ii. Describe five criteria that must be satisfied by an algorithm (3marks)
iii. Give Four practical applications of algorithms (4 marks)

b) Recursion is a widely used technique in problem decomposition


i. Define Recursion and using appropriate diagrams show the difference between
recursion and decomposition (4marks)
ii. Give two advantages of recursion over iteration (2marks)
iii. Describe a scenario in the which, using iteration would be more efficient as opposed
to recursion (2marks)

c)

i. Write the Depth First Search Algorithms used in Graphs


(5marks)

ii. There are 8, 15, 13, and 14 nodes in 4 different trees. Which one of them can form a
full binary tree? (3marks)
iii. Define the term Recurrence Relation (3marks)

d) What is the data structures used to perform recursion? (2marks)


QUESTION 2 (TWO)

a) Define the term Asymptotic Analysis (3marks)


b) Prove that 3N2 + 200N + 6 is O(N2) (4marks)

c) A string W is defined as:

i. An empty string: “”
ii. Matching braces: “( )”
iii. OR W enclosed with matching braces: “( W )”
iv. Series of W enclosed in braces: “( W W)”

Write a C/C++/Java function that takes a string as a parameter then checks whether the string is a
W (6 Marks)

d) Solve the following Recurrence using the repeated substitution method (7marks)

QUESTION 3 (THREE)

a) Divide and conquer is a strategy used in algorithm design


i. Describe the term and elaborate the steps followed in this strategy (4marks)
ii. The Merge sort and the quick sort are both sorting algorithms categorized under
the divide and conquer strategy yet the worst case of Merge sort is

while that of the Quick sort is ( ) explain this disparity (3marks)


iii. The actual sorting in the Merge sort occurs in the merge step, give an algorithm
definition of the merge/combine subroutine of the merge sort (5marks)
b)
i. What is a good solution, and just what factors contribute to a good solution?

(4marks)
ii. Provide a stage wise parse for the following data using the bubble sort algorithm
(i.e. how would the data look after every run) (4marks)

27 78 44 21 12 55 37

QUESTION 4 (FOUR)
a)
i. Explain the worst case of a binary search algorithm; be careful to contrast this with
the linear searching strategy
(5marks)
ii. Write short notes on Linked Lists data structures articulating the different types of
linked lists in the process (4maks)
b)
i. The factorial of a given number is thus defined:

Write a recursive function that obtains the factorial of a number n (4marks)

ii. Carry out an analysis of the Insertion Sort Algorithm given below (7marks)
INSERTION-SORT(A)
1. For i 2 to lenth(A)

2. Key A[i]
3. //insert A[i] into the sorted sequence A[1……i-1]
4. j i-1
5. While j>0 and A[j]>key
6. A[j+1] A[j]

7. j j-i

8. A[j+1] key

You might also like