MCPcopy Index your code
hub / github.com/MeigenChou/DCTimer-Android / permToIdx

Method permToIdx

app/src/main/java/solver/Utils.java:115–124  ·  view source on GitHub ↗
(int[] permutation, int length, boolean even)

Source from the content-addressed store, hash-verified

113
114 // permutation
115 public static int permToIdx(int[] permutation, int length, boolean even) {
116 int index = 0;
117 int end = even ? length - 2 : length - 1;
118 for (int i = 0; i < end; i++) {
119 index *= length - i;
120 for (int j = i + 1; j < length; j++)
121 if (permutation[i] > permutation[j]) index++;
122 }
123 return index;
124 }
125
126 public static void idxToPerm(int[] permutation, int index, int length, boolean even) {
127 int sum = 0;

Callers 15

edgemv2Method · 0.95
initMethod · 0.95
scrambleL2LMethod · 0.95
GearClass · 0.95
HalfTurnClass · 0.95
RouxMUClass · 0.95
getmvMethod · 0.95
CubeRUClass · 0.95
permMoveMethod · 0.95
edgemvMethod · 0.95
getmvMethod · 0.95
getMiMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected