Skip to content

Instantly share code, notes, and snippets.

@jy95
Created November 8, 2014 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jy95/62442839662e15751342 to your computer and use it in GitHub Desktop.
Save jy95/62442839662e15751342 to your computer and use it in GitHub Desktop.
Methode position (recursive)
public int position(Elt e){
int result ;
if (contient(e)) {
result = positionSiContient(e);
}
else {
result = 0;
}
return result;
}
private int positionSiContient(Elt e){
int result ;
if (tete().estEgalA(e)) {
result = 1;
}
else {
result = 1 + corps().positionSiContient(e);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment