Professional Documents
Culture Documents
Assignment 1
Assignment 1
Complexity Analysis
Maximum Marks 100
Note: In the matrix formulation clearly define the variable, base case, and the size of the matrix.
4 4
For the other cases, think of fibonacci sequence, where f0 = f1 = 1 and fi = fi−1 + fi−2 for i ≥ 2. Use
Pk k 2
i=1 fi = fk+2 − 1, fk = O(φ ) and φ = φ + 1, where φ is the golden ratio.
1
3 Analysing Quicksort [20 Marks]
We know the quick sort performs differently based on input. The recursive formulation can be written as:
T (n) = T (k) + T (n − k − 1) + n
1. Show that the above expression is O(n2 ) and Ω(n log n).
2. Substitute suitable values for k to show Θ(n2 ) and Θ(n log n) for different values of k, and describe
the corresponding input accordingly.
Note: Refer to Section 4.5 of CLRS book (3rd Edition) for exhaustive proof of master’s method, and follow
a similar rigorous approach.