mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-25 13:34:54 +08:00
fix: removed warning for Sorts 'C-style array declaration of parameter 'array''
This commit is contained in:
@ -4,7 +4,7 @@ import java.util.Arrays;
|
||||
|
||||
class RadixSort {
|
||||
|
||||
private static int getMax(int arr[], int n) {
|
||||
private static int getMax(int[] arr, int n) {
|
||||
int mx = arr[0];
|
||||
for (int i = 1; i < n; i++)
|
||||
if (arr[i] > mx)
|
||||
@ -12,10 +12,10 @@ class RadixSort {
|
||||
return mx;
|
||||
}
|
||||
|
||||
private static void countSort(int arr[], int n, int exp) {
|
||||
int output[] = new int[n];
|
||||
private static void countSort(int[] arr, int n, int exp) {
|
||||
int[] output = new int[n];
|
||||
int i;
|
||||
int count[] = new int[10];
|
||||
int[] count = new int[10];
|
||||
Arrays.fill(count, 0);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
@ -33,7 +33,7 @@ class RadixSort {
|
||||
arr[i] = output[i];
|
||||
}
|
||||
|
||||
private static void radixsort(int arr[], int n) {
|
||||
private static void radixsort(int[] arr, int n) {
|
||||
|
||||
int m = getMax(arr, n);
|
||||
|
||||
@ -43,14 +43,14 @@ class RadixSort {
|
||||
}
|
||||
|
||||
|
||||
static void print(int arr[], int n) {
|
||||
static void print(int[] arr, int n) {
|
||||
for (int i = 0; i < n; i++)
|
||||
System.out.print(arr[i] + " ");
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
int arr[] = {170, 45, 75, 90, 802, 24, 2, 66};
|
||||
int[] arr = {170, 45, 75, 90, 802, 24, 2, 66};
|
||||
int n = arr.length;
|
||||
radixsort(arr, n);
|
||||
print(arr, n);
|
||||
|
Reference in New Issue
Block a user