Write insertion sort algorithm. Explain the average case analysis.
mahi0409:
Just asking out of curiosity which class are you in
Answers
Answered by
5
ANSWER__✍️
Merge Sort :
Worst, Average and Best Case - O(n*log(n))
Quick Sort :
Worst case - O(n^2)
Average, Best Case - O(n*log(n))
In terms of space complexity, quick sort is space constant, merge depends on the structure provided as input.
Generally, quick sort is considered better as compared to merge sort.
Similar questions