Skip to content

Instantly share code, notes, and snippets.

@oppahero
Last active April 1, 2018 19:57
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 oppahero/11336c842b3f09bb07da8b83db143d92 to your computer and use it in GitHub Desktop.
Save oppahero/11336c842b3f09bb07da8b83db143d92 to your computer and use it in GitHub Desktop.
//Método empleado para los generadores cíclicos
public Permutacion powT(Permutacion perm, int x){
Permutacion result = new Permutacion();
TrianguloEquilatero aux = new TrianguloEquilatero();
if(x==0) //Si la potencia es 0
result =aux.getPi0(); //El resultado es el elemento neutro (PI0)
else if(x==1){ // Si la potencia es 1
result = perm;} // El resultado sera el mismo elemento
else if (x>1){ // Si es mayor a 1, alli multiplicaremos
result = perm; // primero le asignamos el valor del elemento
for (int i = 0; i < x -1; i++) { //Con este ciclo, vamos a repetir la n-1 veces la operacion
result = aux.operarPermutaciones(result, perm); //n-1 veces porque arriba ya asignamos el valor (Que seria el caso cuando es 1)
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment