Which of the following sorting algorithms has the minimum running time complexity in the best and average case?
(A) Insertion sort, Quick sort
(B) Quick sort, Quick sort
(C) Quick sort, Insertion sort
(D) Insertion sort, Insertion sort
Explanation: Insertion sort has a best case complexity of O(n), if the array is already sorted while it has an average case complexity of O(n2)
Quick sort has a best case complexity of O(n log n), while it has an average case complexity of O(n log n) also.
So, option (A) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.