Design and Analysis Cat
Design and Analysis Cat
CAT
UNIT CODE: BIT 3209 UNIT TITLE: DESIGN AND ANALYSIS OF ALGORITHMS
a) Given the following recurrence relation: T(n) = 2T(n/2) + O(n), derive its time
complexity using the Master Theorem. (5 marks)
b) Given the following algorithm for sorting an array, determine its time complexity and
justify your answer: (5 marks)
c) Describe the process of analyzing the time complexity of an algorithm using the Big-O
notation. Provide an example algorithm and walk through how to calculate its time
complexity. (5 marks)
d) Explain the difference between "Binary Search" and "Linear Search". Compare their time
complexities and discuss in which scenarios each would be preferred. (5 marks)
e) Given the following array: [5, 12, 20, 8, 35, 15], apply the Max Heap insertion algorithm
to construct the max heap. (5 marks)
f) Using the graph below, demonstrate how Dijkstra's algorithm is used to find the shortest
path from a given source node to all other nodes.
Graph:
A --(2)-- B --(1)-- C
| | |
(3) (4) (6)
| | |
D --(5)-- E --(7)--—F (5 marks)