Question

In: Computer Science

Why is radix sort generally rejected by so many computer programmers? Under what conditions does Radix-Sort...

  1. Why is radix sort generally rejected by so many computer programmers?
  2. Under what conditions does Radix-Sort run faster than O(n lg n) algorithms such as quicksort?
  3. Under what conditions does Radix-Sort run slower than O(n lg n) algorithms such as quicksort?
  4. How common are each of these conditions?
  5. When do you think a sort such as radix sort would be useful?

Solutions

Expert Solution

1. Radix sort in general is rejected by computer programmers because it is not general, it is more of a specialized algorithm. Moreover other sorting algorithms like quicksort are flexible when used over multiple kinds of data. Radix sort is not much flexible. Also, the time complexity of radix sort is O(n) but when we say this, there is a constant also present in it. So to be precise the time complexity would be a*O(n) where a is some constant value. But in the cases of radix sort this value of a sometimes becomes very large, Thereby, increasing the time complexity. Also radix sort is not memory effecient. It consumes a lot of memory. Moreover Quicksort can also make use of hardware caches and thereby it's utility increased compared to radix sort. These are some of the main reasons why programmers generally tend to avoid radix sort.

2. Now consider a case when you have around a million data items to sort. These data items also contain repeated elements and there is an upper bound associated with them say 1000. Now radix sort will do it in 3*(1 Million) while quick sort will do it in 6*(1 Million). So, in case, when elements are in a fixed range and uniformly distributed, and also tend to repeat, then radix sort outperforms quicksort hugely.

3. Now, if the items are unique, then radix sort might perform poorly compared to other sorting algorithms like quicksort. In most of the cases, this scenario is there hence quicksort is preferred. Moreover, people tend to be unaware of the kind of data they are going to encounter while attempting to sort the data.

4. The cases in which radix sort performs poorly is more than in which it performs better when compared to quicksort. In most of the cases the presence of all items between a specific number range is not true. chances are there that data is completely new to you and you don't know much about it. Hence in general it is advisable to use quicksort unless there is a strong information about data and we know it will be better to use radix sort.

5. Whenever the longest value (or integer) is shorter than the array size, then radix sort will be helpful and better when compared to other algorithms like quicksort. In short you have a set of numbers where range is small and numbers are repeating than radix sort is used.

Hope that helps !!


Related Solutions

. Computer programmers work under much more pleasant conditions than garbage collectors. Yet, according to the...
. Computer programmers work under much more pleasant conditions than garbage collectors. Yet, according to the Bureau of Labor Statistics, the median salary of a sanitation worker is about $35,270 and the median salary of a computer programmer is about $79,840. True or false: This shows that the theory of compensating wage differentials is wrong. Explain.
Wittig Reaction: Under what conditions does the Wittig reaction favor the cis isomer?  Under what conditions does...
Wittig Reaction: Under what conditions does the Wittig reaction favor the cis isomer?  Under what conditions does the Wittig reaction favor the trans isomer? _____________________________________________________________
What does it mean for a system to be under sink conditions? Explain sink conditions in...
What does it mean for a system to be under sink conditions? Explain sink conditions in terms of in vitro and in vivo drug release testing.
Can war ever be justified? If so, under what conditions and with what restrictions? Compare the...
Can war ever be justified? If so, under what conditions and with what restrictions? Compare the views of Natural Law Theory, Utilitarianism, and Divine Command Theory. (400- 500 words)
1.Why does benzyl bromide react under both SN1 and SN2 conditions? Why is bromobenzene unreactive under...
1.Why does benzyl bromide react under both SN1 and SN2 conditions? Why is bromobenzene unreactive under both SN1 and SN2 conditions? 2. If bromobenzene reacts faster than chlorocyclohexane in an SN2 reaction, what could be the reason?
If quicksort is so quick, why bother with anything else? If bubble sort is so bad,...
If quicksort is so quick, why bother with anything else? If bubble sort is so bad, why even mention it? For that matter, why are there so many different sorting algorithms? Your task is to investigate these and other questions in relation to the algorithms selection sort, insertion sort, merge sort, and quicksort. Write a set of guidelines for each algorithm to help someone decide which one would be most appropriate for a particular situation. Include in your guidelines a...
a) why can noble gases bond with other atoms under certain conditions? b) why does MgO...
a) why can noble gases bond with other atoms under certain conditions? b) why does MgO fail in a brittle manner even though the crystal structure of MgO is FCC?
Under what conditions are generalization favored overspecialization and vice versa. Explain why those conditions lead to...
Under what conditions are generalization favored overspecialization and vice versa. Explain why those conditions lead to specialization or generalization. For each of the animals below, tell me the ways they are likely to avoid predation of themselves or their offspring. There can be multiple answers per species. Northern Elephant Seal (Mirounga angustirostris) Broccoli (Brassica oleracea var. Italica) Blue-ringed octopus (Hapalochlaena spp.) Killdeer (Charadrius vociferus) Five-lined skink (Plestiodon faciatus)
Under what conditions are generalization favored overspecialization and vice versa. Explain why those conditions lead to...
Under what conditions are generalization favored overspecialization and vice versa. Explain why those conditions lead to specialization or generalization. For each of the animals below, tell me the ways they are likely to avoid predation of themselves or their offspring (tactics that may be employed to deter predators, camouflage techniques, behavioral techniques/postures, etc.).  There can be multiple answers per species. You’ll have to use your web skills to look these up! Put some thought into it! Northern Elephant Seal (Mirounga angustirostris)...
Under what conditions would a seller be willing to sell on consignment? Under what conditions would...
Under what conditions would a seller be willing to sell on consignment? Under what conditions would a seller be willing to sell on terms of cash before delivery? Lastly, Under what conditions would a buyer be comfortable with each of these two extreme terms of sale? (on consignment OR cash before delivery)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT