Absteigende Sortierung implementiert
parent
45b8f7b164
commit
818f0d3787
|
@ -15,8 +15,17 @@ public class C3PO extends Robotermodell implements Robot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] think(int[] zahlen) throws RobotException {
|
public int[] think(int[] zahlen) throws RobotException {
|
||||||
// TODO Auto-generated method stub
|
for (int i = 0; i < zahlen.length - 1; i++) {
|
||||||
return null;
|
int k = i;
|
||||||
|
while (k >= 0 && zahlen[k] < zahlen[k+1]) {
|
||||||
|
int zwischenspeicher = zahlen[k];
|
||||||
|
zahlen[k] = zahlen[k+1];
|
||||||
|
zahlen[k+1] = zwischenspeicher;
|
||||||
|
k--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return zahlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue