Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is in java. You have to sort an array of student-ids. Student ids have a range 1- 99999. Write a program to sort the

This is in java. You have to sort an array of student-ids. Student ids have a range 1- 99999. Write a program to sort the following student id's in ascending order using radix (bucket) sort and print the sorted list on console. You are not allowed to use Java API list classes.

Format of I/O:

Enter the list of integers to be sorted, separated by blank spaces: 8178 32 315 19 45921 7130 4 563 1999 390 2873 431

Number of passes required: 5

Pass 1 buckets are: 0: 390 7130 1: 431 45921 2: 32 3: 563 2873 4: 4 5: 315 6: 7: 8: 8178 9: 19 1999

Pass 2 buckets are: 0: 4 1: 19 315 2: 45921 3: 32 431 7130 4: 5: 6: 563 7: 2873 8178 8: 9: 390 1999

Pass 3 buckets are: 0: 4 19 32 1: 7130 8178 2: 3: 315 390 4: 431 5: 563 6: 7: 8: 2873 9: 1999 45921

Pass 4 buckets are: 0: 4 19 32 315 390 431 563 1: 1999 2: 2873 3: 4: 5: 45921 6: 7: 7130 8: 8178 9:

Pass 5 buckets are: 0: 4 19 32 315 390 431 563 1999 2873 7130 8178 1: 2: 3: 4: 45921 5: 6: 7: 8: 9: Sorted List: 4 19 32 315 390 431 563 1999 2873 7130 8178 45921

Your program must the print out of the contents of each bucket after every pass and the final sorted list to get full credit.

b) Repeat the same sort with the same input using 100 buckets numbered 0..99 instead of 10 buckets. For the 100 buckets you should look at two digits at a time in every pass for every number starting from the least significant position. So 8178 would go to bucket #78 in pass 1 and bucket #81 in pass 2. You must the print out of the contents of each bucket after every pass to and the final sorted list, as shown in the example in part a) to get full credit.

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

Describe how to measure the quality of work life.

Answered: 1 week ago

Question

What attracts you about this role?

Answered: 1 week ago

Question

How many states in India?

Answered: 1 week ago