Question: give a code in java ( please there should not be plagiarism ) A . Bucket Sort You are given an array with n integers.

give a code in java(please there should not be plagiarism)
A. Bucket Sort
You are given an array with n integers. You are to apply bucket sort to sort this array. Given a pre-defined number of equally-sized buckets b that you need to use, your task is to output the contents of each bucket at the end of the process.
You are expected to divide the input range into b equal-sized buckets. It is guaranteed that this is possible, for this problem. For example if the input array is [15,13,12,10,8,8,4] and b=4, then the bucket ranges will be [4,6] and [13,15]
Input
The first line contains two space-separated integers n(1n105)-
the size of the array, and b(1b1000)- the number of equal-
sized buckets you are to use. The second line contains n intogers
a1,a2,...,an(-1012a41012)- the elements of the array.
Output
Print b lines - each one corresponding to the contents of the b buckets
after sorting, respectively. Each of these b lines should contain space-
separated integers, the first of which would be k- the number of integers placed in that bucket. k integers follow in the same line - the contents of the bucket, in sorted order.
input
74
15131210884
output
14
288
21012
21315
input
101
1750-16123-1191220
output
10-16-10351212171920
input
2720
152514-2624676260-9180-25-25-21-11-22-27-7-1
21201302432
output
4-27-26-25-25
1-22
1-21
0
0
1-11
2-9-7
0
1-1
3000
0
3667
0
21314
115
21820
121
424242526
0
132
give a code in java(please there should not be plagiarism)
give a code in java ( please there should not be

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 Programming Questions!