Sorting algorithms are important concepts and should be understood properly :-
1. Quick sort :- Everything is about the selection of pivot. If we choose pivot randomly and say i selected a pivot which is the greatest or least element, and following that if I partition the array then:
T (n) = T (n-1) + n = O(n^2)
Else if pivot is not the greatest or smallest then it's equivalent to:-
T(n) = 2T (n/2) + n = O (nlogn)
2.In case of merge sort it doest depend on pivot sort of thing hence it's not a liability here it is based on dividing the array and sorting these small arrays and combining them :-
T (n) = 2T (n/2) + n = O (nlogn)
3. Shell sort what to say it's nearly like insertion sort.
Shell sort best case -> O(nlogn), Worst Case-> O(n^2)
4. Heap sort :- it's based on a complete binary tree whose height is logn. Hence for creating heap = O (n) and after that we delete the root (heap means min heap) we get 1st smallest element it takes O (logn) per delete operation. Hence for n delete operation: - O (nlogn) which is it's best and worst case.