Permutation.fromInversions constructor
Implementation
Permutation.fromInversions(List<int> inv)
: _indices = List.filled(inv.length, 0, growable: false) {
for (int i = 0; i < inv.length; i++) {
_indices[i] = i;
}
for (int i = inv.length - 1; i >= 0; i--) {
if (_indices[i] != inv[i]) {
int t = _indices[i];
_indices[i] = _indices[inv[i]];
_indices[inv[i]] = t;
}
}
}