From d7c5b9ad7dd354c8f3c154e9512febaf39c0894e Mon Sep 17 00:00:00 2001 From: Speiger Date: Thu, 15 Jun 2023 18:08:57 +0200 Subject: [PATCH] Optimized SelectionSort a tiny bit. --- .../speiger/assets/collections/templates/utils/Arrays.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template b/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template index a59ef3a..338b181 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template @@ -690,7 +690,7 @@ public class ARRAYS * @ArrayType(T) */ 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]; int minId = i; for(int j = i+1; j < to; j++) {