Last updated on October 1, 2016
I’ve written a C++ code snippet to compute the index of permutation according to this post:
The code was written to be easily adapted into C code. To adapt the code above to C code, simply replace all template types with the type you want and remove all the template declaration.