Optimized SelectionSort a tiny bit.

This commit is contained in:
Speiger 2023-06-15 18:08:57 +02:00
parent d2c81e7779
commit d7c5b9ad7d
1 changed files with 1 additions and 1 deletions

View File

@ -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++) {