@@ -57,15 +57,15 @@ private <T extends Comparable<? super T>> void flashSort(T[] arr) {
57
57
58
58
final int m = (int ) (CLASSIFICATION_RATIO * arr .length );
59
59
60
- final int [] L = new int [m ];
60
+ final int [] classificationArray = new int [m ];
61
61
62
62
final double c1 = (double ) (m - 1 ) / (arr [maxIndex ].compareTo (min ));
63
63
64
- classify (arr , L , c1 , min );
64
+ classify (arr , classificationArray , c1 , min );
65
65
66
- transform (L );
66
+ transform (classificationArray );
67
67
68
- permute (arr , L , c1 , min , arr .length , m );
68
+ permute (arr , classificationArray , c1 , min , arr .length , m );
69
69
70
70
insertionSort (arr );
71
71
}
@@ -132,33 +132,33 @@ private void transform(final int[] L) {
132
132
}
133
133
134
134
/**
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 .
136
136
*
137
137
* @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.
139
139
* @param c1 the normalization constant used to map the elements to the classification array.
140
140
* @param min the minimum value in the array.
141
141
* @param n the length of the array.
142
142
* @param m the number of classes in the classification array.
143
143
* @param <T> the type of elements in the array, must be comparable.
144
144
*/
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 ) {
146
146
int move = 0 ;
147
147
int j = 0 ;
148
148
int k = m - 1 ;
149
149
T flash ;
150
150
while (move < n - 1 ) {
151
- while (j > L [k ] - 1 ) {
151
+ while (j > classificationArray [k ] - 1 ) {
152
152
j ++;
153
153
k = (int ) (c1 * (arr [j ].compareTo (min )));
154
154
}
155
155
flash = arr [j ];
156
- while (j != L [k ]) {
156
+ while (j != classificationArray [k ]) {
157
157
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 ;
160
160
flash = temp ;
161
- L [k ]--;
161
+ classificationArray [k ]--;
162
162
move ++;
163
163
}
164
164
}
0 commit comments