Created
November 8, 2014 14:19
-
-
Save jy95/62442839662e15751342 to your computer and use it in GitHub Desktop.
Methode position (recursive)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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