Generate permutations of a string in C++

This code uses Heap’s Algorithm(https://en.wikipedia.org/wiki/Heap%27s_algorithm) to generate all distinct. This algorithm can be written in any language but we provide implementation in C++ below. Following C++11 features are used: std::swap to swap string indices std::string to represent the string It is recommended that the following code be compiled on a …