Optimized SelectionSort a tiny bit.
This commit is contained in:
parent
d2c81e7779
commit
d7c5b9ad7d
|
@ -690,7 +690,7 @@ public class ARRAYS
|
||||||
* @ArrayType(T)
|
* @ArrayType(T)
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_BRACES void selectionSort(KEY_TYPE[] array, int from, int to) {
|
public static GENERIC_KEY_BRACES void selectionSort(KEY_TYPE[] array, int from, int to) {
|
||||||
for (int i = from; i < to; i++) {
|
for (int i = from,m=to-1; i < m; i++) {
|
||||||
KEY_TYPE min = array[i];
|
KEY_TYPE min = array[i];
|
||||||
int minId = i;
|
int minId = i;
|
||||||
for(int j = i+1; j < to; j++) {
|
for(int j = i+1; j < to; j++) {
|
||||||
|
|
Loading…
Reference in New Issue