Question: In this homework, you will implement a sorting algorithm based on the provided Java source code BucketSort.java. You need to implement the bucket sort algorithms

In this homework, you will implement a sorting algorithm based on the provided Java source code BucketSort.java. You need to implement the bucket sort algorithms as a Java method named sortData to rank the given integer numbers in the given array named data in descending order. The instructor provides you a Java source code template as shown below named BucketSort.java, which can be downloaded from Blackboard. public class Bucket Sort { // Create a function named sortData which implements bucket sort algorithm // by sorting the given data in descending order and display the sorted data. // To implement the method, you need to 17 (1) Create an array named buckets to count the frequency for each number within the range between 0 and 19. // (2) Retrieve a value from the data and increase the count in the corresponding bucket. 11 (3) Construct and display the sorted data based on the counts in the buckets public static void main(String[] args) { // Create an array named data with 20 integer numbers. // The numbers should be within the range between 0 and 19. int[] data - {10, 12, 15, 5, 3, 5, 10, 1, 2, 5, 19, 5, 2, 5, 4, 4, 5, 7, 10, 5); // Use sortData method to sort the given data array in descending order 1 // end of main } // end of class You are required to complete the tasks as listed below: 1. The submitted Java program should not have compilation error (10 Points) 2. The Java program is well organized with proper indent (10 Points) 3. The Java program should have detailed comments to explain your code (10 Points) 4. Implement main function correctly (10 Points) 5. Create sortData function header correctly (10 Points) 6. Obtain the counts for each number correctly (20 Points) 7. Construct and display the sorted data based on the counts in the buckets (20 Points) 8. On-time submission (10 Points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
