Problem title
Difficulty
Avg time to solve

Ninja And Editor
Easy
20 mins
Encoded Letter
Moderate
25 mins
Tree Jumping
Hard
50 mins
Base Conversion
Easy
15 mins
Number of ones in the smallest repunit
Moderate
30 mins
Conversion
Easy
20 mins
Remove Comments
Moderate
15 mins
Last Substring In Lexicographical Order
Hard
45 mins
Minimum And Maximum
Easy
15 mins
Rectangles In N x N Board
Moderate
20 mins

Bucket Sort

Difficulty: MEDIUM
Contributed By
Avg. time to solve
15 min
Success Rate
85%

Problem Statement

Ninja recently came to know about sorting and searching in an array and he wants to learn the trick to sorting an array.

So he has been provided with an array ‘ARR’ of size ‘N’ with values that are uniformly distributed across the range [0, 1] and you have to sort them in an optimal manner. Please set the precision to 2 decimal digits.

Example:
Input: 'N' = 4, 'ARR' = [0.79, 0.66, 0.65, 0.12]

Output: [0.12, 0.65, 0.66, 0.79]

The given array, after sorting in a non-decreasing manner looks like the output given.
Input Format :
The first line will contain the integer 'T', denoting the number of test cases.

The first line for each test case contains a single integer 'N', the size of the array ‘ARR’.
The second line will contain ‘N’ integers representing the array elements.
Output format :
For each test case, print the minimum sum of elements.
Note :
You don't need to print anything. It has already been taken care of. Just implement the given function.
Constraints :
1 <= 'T' <= 10
1 <= 'N' <= 10^5
0 <= ‘ARR[i]’ <= 1, ARR[i] is of exactly 2 decimal places.

Time Limit: 1 sec
Sample Input 1 :
2 
3
0.22 0.12 0.32
4
0.55 0.23 0.83 0.93
Sample Output 1 :
0.12 0.22 0.32 
0.23 0.55 0.83 0.93 
Explanation Of Sample Input 1 :
For the first case:
The array after sorting in non-decreasing order looks like the output.

For the second case:
The array after sorting in non-decreasing order looks like the output.
Sample Input 2 :
2
2
0.50 0.90
1
0.32
Sample Output 2 :
0.50 0.90
0.32    
Reset Code
Full screen
copy-code
Console