Hallo
Ich hab das folgende Programm geschrieben:
Ich weiß noch nicht genau die Syntax der Programmiersprache Java und deshalb habe ich Kommentare gemacht, in die steht was ich machen will. Würde mich sehr freuen wenn jemand mir helfen konnte. Vielen Dank im Voraus!
Ich hab das folgende Programm geschrieben:
Java:
public class Intersection {
/*
requires a != null
ensures \result == (es existiert ein int i in [0,a.length -1], so dass a[i] == x)
*/
public static boolean contains(int[] a, int x) {
return false; // TODO
}
/*
requires a != null
ensures \result == (für alle int i in [0,a.length -2]: a[i] < a[i+1])
*/
public static boolean increasing (int[] a) {
return false; // TODO
}
/*
requires a != null
&& b != null
&& increasing(a)
&& increasing(b)
ensures \result != null
&& für alle int x: (contains(a, x) && contains(b, x)) == contains(\result , x)
&& increasing(\result)
*/
public static int[] intersection (int[] a, int[] b) {
return null; // TODO
}
}
Ich weiß noch nicht genau die Syntax der Programmiersprache Java und deshalb habe ich Kommentare gemacht, in die steht was ich machen will. Würde mich sehr freuen wenn jemand mir helfen konnte. Vielen Dank im Voraus!