Question: You are required to sort a file containing integers between 0 and 999,999. You cannot afford to use one million pigeon-holes, so you decide instead

You are required to sort a file containing integers between 0 and 999,999. You cannot afford to use one million pigeon-holes, so you decide instead to use one thousand pigeon-holes numbered 0 to 999. You began the sort by putting each integer into the pigeon-hole corresponding to its first three figures. Next, you use insertion sorting one thousand times to sort the contents of each pigeon-hole separately, and finally, you empty the pigeon-holes in order to obtain a completely sorted sequence.

Would you expect this technique to be faster, slower or the same as simply using insertion sorting on the whole sequence (a) on the average, and (b) in the worst case? justify your answers.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!