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.
-
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.
-
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started