Bubblesort implementiert aus der VL #3
|
|
@ -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
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||
void main() {
|
||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> 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 <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
||||
IO.println("i = " + i);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
public static void main(String[] args){
|
||||
System.out.println("Test");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue