# hw2s - Cs445 Homework#2 Lower bound on Sorting Radix Sort...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Advantage - It is easier to work backwards from LSD since order based on MSD is not disturbed by LSD. Disadvantage - Requires padding of short keys if key length is variable.Also, all digits are examined even if the first 3-4 digits may contain all the information need to achieve a sorted order. 2. Assume that the running time of merge sort is O ( n log n ), and the running time of sorting n numbers, each of k decimals digits, using Radix sort, is O ( nk ). Prove that if no two numbers in the input are the same, then radix sort is always not faster than merge sort. Does this implies that you would always use merge sort over radix sort ? Answer: Since we are given that no two input numbers are the same, the number of digits in the largest number must be at least log 10 n . This is because, a ‘k’ digit decimal number, can have 10 k possible values. Thus, the fact that no two input numbers are the same implies that k log 10 n . There- fore, it follows that radix sort is always not faster than merge sort.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern