Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

KOLADAISI UNIVERSITY, IBADAN

Faculty of Applied Sciences


Department of Mathematical and Computing Sciences
Second Semester Examination 2019/2020 Session

CSC 210: Algorithm and Complexity Analysis (3 Units) Time: 3 hours


INSTRUCTION: Answer question 1 and ANY other three questions

1. (a) Mention five characteristics of an algorithm (5mks)


(b) What is complexity of an algorithm? (4mks)
(c) Complete the table below (4mks)
Type Size
bool, char, unsigned char, signed char, __int8
__int16, short, unsigned short, wchar_t, __wchar_t
float, __int32, int, unsigned int, long, unsigned long
double, __int64, long double, long long

(d) Give the worst case time, average case time and best case time complexity of heap Sort (3mks)
(e) State the two properties of asymptotic notations (2mks)
(f) Highlight three advantages of sequential search algorithm (3mks)
(g) What is sorting algorithm? (2mks)
(h) Define the term linear probing in hashing technique (2mks)

2. (a) Draw the adjacency matrix for the directed graph given below (5mks)

(b) Mention any four types of an algorithm (4mks)


(c) Explain the three basic primary operations involved in hash table (6mks)
3. (a) When is an algorithm considered to be good (5mks)
(b) Write the missing line for the following program (5mks)
int count = 0
……………………………….
for (int j =0; j<1; j++)
Count ++
. (c) Highlight the two reasons for memory usage during execution of algorithm (5mks)

4. (a) Explain briefly two representations of graph data structure (5mks)


(b) What is big-oh notation in time complexity (5mks)
(c) Complete the following quick sort implementation (5mks)
def partition(arr,low,high):
i = ( low-1 ) # index of smaller element
pivot = arr[high] # pivot
for j in range(low , high):
# If current element is smaller than or
# equal to pivot
if arr[j] <= pivot:
# increment index of smaller element
i = i+1
(……………………………………………)

arr[i+1],arr[high] = arr[high],arr[i+1]
(………………………………………)

5. (a) Differentiate between mini-Heap and max-Heap in binary search tree (BST) (5mks)
(b) Define the following terms used in graph data structure (6mks)
(i) Adjacency (ii) Edge (iii) Vertex
(c) Discuss the two measures used in algorithm complexity (4mks)

6. (a) Explain how the following operations work in binary search tree (BST) (5mks)
(i) Insertion in BST (ii) Deletion in BST
(b) Compute the space complexity for the following expression. (5mks)
{
int z = a + b + c;
Return(z);
}

(c) List the five steps involved in complete running time of an algorithm (5mks)

You might also like