CSC 308 Exam 2024
CSC 308 Exam 2024
1a. Differentiate between Merge sort and Burble sort algorithms with the reference to their
time complexity. [7 Marks]
1b. Calculate the running time for the algorithm below
do until the pointers low and high meet each other.
mid = (low + high)/2
if (x == arr[mid])
return mid
else if (x > arr[mid]) // x is on the right side
low = mid + 1
else
high = mid – 1 [8 Marks]
2a. Write short note on any two of the following operations on a graph
i. BFS
ii. Walk
iii. DFS [ 6 Marks]
2b. With the help of the simplifying rules of asymptotic analysis, evaluate the running time of the
following functions
a. f(n) = 3n4 +4000n2 - 500n +45.
b. f(n) = nlog200 + 200! + xn
c. =n+ [9 Marks]
3a. With the help of an example, differentiate between P and NP problems [5 Marks]
3b. What is the practical advantage to knowing that a problem is NP-complete. [5 Marks]
3c. Discuss on Complexity Analysis [5 Marks]
a. b. c. [6 Marks]
Page 1 of 2
5a. Generate an Adjacency matrix and Adjacency List for the Graph below [8 Marks]
5b. Itemize four (4) examples each for P and NP problems. [7 Marks]
Page 2 of 2