Problem 4. The scientists of Space Lab want to sort their remote sensoring data
ID: 3723053 • Letter: P
Question
Problem 4. The scientists of Space Lab want to sort their remote sensoring data to reconstruct the 3-D images of the surface of Mars. They have one million 64-bit integers to sort. 1. If they use quicksort, estimate the number of key value comparisons per- formed. (Hint: consider the average time complexity of quicksort.) 2. If they treat these integers as four-digit, radix-216 numbers and use straight radix sort based on the radix-216 notation, how many sorting passes are required to do the sorting? 3. Unfortunately, the computer in the Space Lab has only 9 megabytes of available memory for running the sorting task Is it practical to choose bucket sort to be the stable sorting method in the implementation of the above straight radix sort? Explain your answerExplanation / Answer
1) Number of key value comparisions performed = nlog n = 106 * (log 106) = 6 * 106
2) For every digit in a radix sort , we need to have a pass. We need to have 4 passes.
3) Radix sort is a stable sort . So the sort is stable. Hence, it is practical to choose the bucket sort to be the stable sorting method in the implementation of the above radix sort.
where a,b,c etc all in range 0..9. These digits are easily small enough to do bucket sort.
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.