Among Selection Sort, Insertion Sort, Mergesort, Quick sort and Heapsort, which
ID: 3659636 • Letter: A
Question
Among Selection Sort, Insertion Sort, Mergesort, Quick sort and Heapsort, which algorithm would you choose in each list-sorting situation below? Justify your answers. [Note: you do not need to include or produce any code for this question. Consider reviewing chapter 12 however - especially the analysis section - for each type of algorithm.] a) The list has about 45,000 records. It is necessary that the sort be completed reasonably quickly in all cases. There is barely enough memory to hold the 45,000 records. b) The list has about 45,000 records, but it starts off only slightly out of order. c) The list has about 25,000 records. It is desirable to complete the sort as quickly as possible on average, but it is not critical that the sort be completed quickly in every single case.Explanation / Answer
(a) ofcourse merge sort because it is the best algorithm for all cases. plus space complexity of merge sort is O(n) and as in the question memory is enough so u can use it (b) heap sort as it does in breaks.so perfect for the question (c) quick sort it is best in average case
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.