Anasayfa
/
Teknoloji
/
Which Sorting Algorithm Has the Best Average -case Time Complexity? A. Selection Sort B. Bubble Sort C. Merge Sort C D. Quick Sort

Soru

Which sorting algorithm has the best average -case time complexity? a. Selection Sort b. Bubble Sort c. Merge Sort C d. Quick Sort Clear my choice

Çözüm

4.7 (274 Oylar)
Cemal
Uzman doğrulaması
Kıdemli · 11 yıl öğretmeni

Cevap

The correct answer is c. Merge Sort.Merge Sort has the best average-case time complexity of O(n log n), where n is the number of elements in the array. This is because Merge Sort uses a divide-and-conquer approach, which allows it to efficiently sort large datasets.In contrast, Selection Sort and Bubble Sort have a time complexity of O(n^2), which means their performance degrades significantly as the size of the input increases. Quick Sort has an average-case time complexity of O(n log n), but its worst-case time complexity is O(n^2), which makes Merge Sort a more reliable choice for sorting large datasets.