Alorithms · Class 12 · CBSE · Science Computer Science
Explain why merge sort is generally preferred over selection sort for sorting a large collection of data. State the time complexity of both algorithm…
Practice question from Alorithms (Class 12 · CBSE · Science Computer Science), with the correct answer and a step-by-step solution.
hard · Subjective · Q-5AFFB3
Explain why merge sort is generally preferred over selection sort for sorting a large collection of data. State the time complexity of both algorithms in the average or worst case.
Solution
Merge sort has O(n log n) average and worst-case time complexity, while selection sort has O(n²) complexity. Therefore, merge sort scales better as the input size increases, although it uses extra space during the merge process.
More from Alorithms
- Which condition is necessary before applying binary search to an array?
- Explain why binary search cannot generally be applied directly to an unsorted array. Also state the worst-case time complexity of linear se…
- What is the array after the first complete pass of selection sort in ascending order on [29, 10, 14, 37, 13]?
- Which statement correctly describes the worst-case time complexity of insertion sort and the situation in which it performs efficiently?
Practise more Computer Science
Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.
Start practising freeFree to start · No credit card needed