Question: This is in java and the linked list has to be created and cannot use the Java API list classes. You have to sort an

This is in java and the linked list has to be created and cannot use the Java API list classes. 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. Instead of 10 buckets 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 below. Print all 100 buckets.

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

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!