Skip to content
Snippets Groups Projects
Commit 776104f5 authored by Thomas Lapp's avatar Thomas Lapp
Browse files

ajout main get centre

parent 723322b7
Branches
No related merge requests found
package p4a;
public class MainArrayListStdGetCentre {
public static void main(String[] args) {
ArrayListStd<Integer> arrayList = new ArrayListStd<Integer>();
int nbOperation = Integer.parseInt(args[0]);
for (int i = 0; i < nbOperation; i++) {
arrayList.ajout(0, i);
}
for (int i = 0; i < nbOperation; i++) {
arrayList.acces((nbOperation/2)%2==0?nbOperation/2:(int)(nbOperation/2-0.5));
}
}
}
package p4a;
public class MainLinkedListStdGetCentre {
public static void main(String[] args) {
LinkedListStd<Integer> linkedList = new LinkedListStd<Integer>();
int nbOperation = Integer.parseInt(args[0]);
for (int i = 0; i < nbOperation; i++) {
linkedList.ajout(0, i);
}
for (int i = 0; i < nbOperation; i++) {
linkedList.acces((nbOperation/2)%2==0?nbOperation/2:(int)(nbOperation/2-0.5));
}
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment