Skip to content

Commit 5b6e6c9

Browse files
author
Alex Klymenko
committed
checkstyle: fix naming, from L to classificationArray
1 parent c9db5b0 commit 5b6e6c9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/main/java/com/thealgorithms/sorts/FlashSort.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ private <T extends Comparable<? super T>> void flashSort(T[] arr) {
5757

5858
final int m = (int) (CLASSIFICATION_RATIO * arr.length);
5959

60-
final int[] L = new int[m];
60+
final int[] classificationArray = new int[m];
6161

6262
final double c1 = (double) (m - 1) / (arr[maxIndex].compareTo(min));
6363

64-
classify(arr, L, c1, min);
64+
classify(arr, classificationArray, c1, min);
6565

66-
transform(L);
66+
transform(classificationArray);
6767

68-
permute(arr, L, c1, min, arr.length, m);
68+
permute(arr, classificationArray, c1, min, arr.length, m);
6969

7070
insertionSort(arr);
7171
}
@@ -132,33 +132,33 @@ private void transform(final int[] L) {
132132
}
133133

134134
/**
135-
* Permutes the array into sorted order based on the classification array L.
135+
* Permutes the array into sorted order based on the classification array classificationArray.
136136
*
137137
* @param arr the array to be permuted.
138-
* @param L the classification array holding the count of elements in each class.
138+
* @param classificationArray the classification array holding the count of elements in each class.
139139
* @param c1 the normalization constant used to map the elements to the classification array.
140140
* @param min the minimum value in the array.
141141
* @param n the length of the array.
142142
* @param m the number of classes in the classification array.
143143
* @param <T> the type of elements in the array, must be comparable.
144144
*/
145-
private <T extends Comparable<? super T>> void permute(final T[] arr, final int[] L, final double c1, T min, int n, int m) {
145+
private <T extends Comparable<? super T>> void permute(final T[] arr, final int[] classificationArray, final double c1, T min, int n, int m) {
146146
int move = 0;
147147
int j = 0;
148148
int k = m - 1;
149149
T flash;
150150
while (move < n - 1) {
151-
while (j > L[k] - 1) {
151+
while (j > classificationArray[k] - 1) {
152152
j++;
153153
k = (int) (c1 * (arr[j].compareTo(min)));
154154
}
155155
flash = arr[j];
156-
while (j != L[k]) {
156+
while (j != classificationArray[k]) {
157157
k = (int) (c1 * (flash.compareTo(min)));
158-
T temp = arr[L[k] - 1];
159-
arr[L[k] - 1] = flash;
158+
T temp = arr[classificationArray[k] - 1];
159+
arr[classificationArray[k] - 1] = flash;
160160
flash = temp;
161-
L[k]--;
161+
classificationArray[k]--;
162162
move++;
163163
}
164164
}

0 commit comments

Comments
 (0)