The recurrence equation is
T(n) = T(n – 1) + T(1) + cn
In quick sort, worst case divide the list into two
list with 1 and (n – 1) elements each time.
Data Structures and Algorithms MCQ - Performance Analysis of Algorithms and Recurrences
When we put (a, left–End, K) and (a+ left – end + 1,
n– left – end –1, k– left–end –1)at the place of fill
in the blank algorithm work for partition.
Complexity is remain same because we had swap
after finding to position of element so in worst
case swapping for each element requires Q (n) time
hence complexity is O (n2).
114
Merge sort uses
If we take example, 40, 30, 10, 12, 85, 48, 9, 16
Next step : 30, 40, 10, 12, 35, 48, 9, 16
Next step : 10, 12, 30, 40, 9, 16, 35, 48
If array of size n with n inversion then complexity
of insertion sort is Q (n)
Let us take an example.
(6 1 2 3 5 6 4)
total no. of comparision require to
sort above array is 2 (n–1) = 2* 5 = 10
so complexity is Q (n).

