Question: Write a function (e.g. RadixSort(szList)) that accepts a List of sz random integers, and does the following: Create a queue (called the main bin) and

Write a function (e.g. RadixSort(szList)) that accepts a List of sz random integers, and does the following:

Create a queue (called the "main bin") and fill it with sz random integers between 100,000 and 999,999 (i.e. 6-digit integers). Hint: use the function random.sample() to generate sz unique integers

Create a list of 10 empty queues 0-9 (10 digit-bins)

  • Consider the ones digit in your collection of 6-digit integers

  • Dequeue each number from the main bin and enqueue them into the appropriate digit bin

  • Dequeue your numbers from each digit bin in order and enqueue them back into the main bin

  • Repeat the process for the tens digit; and then the hundreds; and the thousands, etc.

  • Dequeue each number out of the main bin back into a List and return this final list.

  1. Print before- and after- views of a list of ten or so values in a Test-Run of your RadixSort code, to make sure it is actually sorting.

  2. Generate timings of this function for n = 2000-20,001 items in evenly-spaced steps of 2000 (or whatever sizes make sense for you and your machine) to generate 10 points to graph

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!