Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions