diff --git a/src/Bubblesort.java b/src/Bubblesort.java new file mode 100644 index 0000000..e8932fc --- /dev/null +++ b/src/Bubblesort.java @@ -0,0 +1,27 @@ +public static void main(String[] args){ + +} + +public static void bubblesort(int[] arr){ + /// aus der Vorlesung: + boolean ready = false; + + while (!ready) { + ready = true; + + for (int i = 0; i < arr.length -1; i++) { + + if (arr[i] > arr[i+1]) { + ready = false; + + int m = arr[i]; + arr[i] = arr[i+1]; + arr[i+1] = m; + } // if + + } // for + + System.out.println(Arrays.toString(arr)); + } // while + +} \ No newline at end of file diff --git a/src/src/Main.java b/src/src/Main.java new file mode 100644 index 0000000..3d87d6e --- /dev/null +++ b/src/src/Main.java @@ -0,0 +1,13 @@ +//TIP To Run code, press or +// click the icon in the gutter. +void main() { + //TIP Press with your caret at the highlighted text + // to see how IntelliJ IDEA suggests fixing it. + IO.println(String.format("Hello and welcome!")); + + for (int i = 1; i <= 5; i++) { + //TIP Press to start debugging your code. We have set one breakpoint + // for you, but you can always add more by pressing . + IO.println("i = " + i); + } +} diff --git a/.idea/src/test.java b/src/test.java similarity index 94% rename from .idea/src/test.java rename to src/test.java index 1ad922f..e5103ff 100644 --- a/.idea/src/test.java +++ b/src/test.java @@ -1,3 +1,5 @@ public static void main(String[] args){ System.out.println("Test"); -} \ No newline at end of file +} + +