From 2906cd48f62128de99021758cbcbf786169d964e Mon Sep 17 00:00:00 2001 From: student <3024753@stud.th-mannheim.de> Date: Wed, 25 Mar 2026 13:38:27 +0100 Subject: [PATCH] Merge branch 'main' of https://gitty.informatik.hs-mannheim.de/3024753/PR2-Hummel-3024753.git into main --- PR2pvl/src/InsertionSort.java | 4 ++++ PR2pvl/src/SelectionSort.java | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 PR2pvl/src/InsertionSort.java create mode 100644 PR2pvl/src/SelectionSort.java diff --git a/PR2pvl/src/InsertionSort.java b/PR2pvl/src/InsertionSort.java new file mode 100644 index 0000000..d90b82f --- /dev/null +++ b/PR2pvl/src/InsertionSort.java @@ -0,0 +1,4 @@ + +public class InsertionSort { + +} diff --git a/PR2pvl/src/SelectionSort.java b/PR2pvl/src/SelectionSort.java new file mode 100644 index 0000000..7b34b32 --- /dev/null +++ b/PR2pvl/src/SelectionSort.java @@ -0,0 +1,22 @@ + +public class SelectionSort { + + public static int[] selectionSort(int[] arr) { + int tmp; + int index = 0; + + for(int i=0; i < arr.length; i++) { + tmp = arr[i]; + for(int j = 0; j < arr.length; j++) { + if(arr[j] < tmp) tmp = arr[j]; + index = j; + } + arr[index] = arr[i]; + arr[i]=tmp; + + } + + + return arr; + } +}