import java.util.ArrayList; public class ArrayListTrie extends ArrayList { public void inserer(int entier) { int i = size(); add(entier); while ((i >= 1) && (get(i - 1) > entier)) { set(i, get(i - 1)); i--; } set(i, entier); } public void supprimer(int entier) { int i = 0; int taille = size(); while ((i < taille) && (get(i) != entier)) i++; if (i < taille) { while (i < taille - 1) { set(i, get(i + 1)); i++; } remove(taille - 1); } } public String toString() { String chaine=""; for (int i : this) chaine = chaine.concat(i + " "); return chaine; } void afficher() { System.out.println(this); } }