Explanation : 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.
Explanation : 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.
Explanation : 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).
Explanation : 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).