Professional Documents
Culture Documents
CO-2
12. What is recurrence? Solve following recurrence relations using iterative method.
(i) T(n) = T(n - 1) + 1 with T(0) = 0 as initial condition
(ii) T(n) = 2T(n / 2) + n
Page 1 of 2
13. Solve following recurrence relation using substitution method and express your answer
using Big-oh (O) notation. T(n) = 2T(n/2) + n2
14. Solve following recurrence relation using suitable method and express your answer
using Big-oh (O) notation. T(n) = T(n/3) + T(2n/3) + Ө(n)
15. Write the Master theorem. Solve following recurrence using it.
(i) T(n)=9T(n/3) + n
(ii) T(n)=3T(n/4) + nlgn
(iii) T(n) = T(2n/3) + 1
(iv) T(n)=2T(n/2) + n log n
16. Write and analyze the quick sort algorithm to arrange n items into ascending order. Sort
the array A=<25, 29, 30, 35, 42, 47, 50, 52, 60> using the same.
17. Write and analyze the merge sort algorithm to arrange n items into ascending order.
Trace the merge sort for the array A=<2, 7, 3, 5, 1, 9, 4, 8>.
18. Write and analyze the Binary Search Algorithm. Demonstrate Binary Search method to
search Key = 14, form the array A=<2, 4, 7, 8, 10, 13, 14, 60>
Page 2 of 2