what is the time complexity of std::next_permutation() function in c++?
c++, stl
Solution
See http://www.sgi.com/tech/stl/next_permutation.html:
Linear. At most (last - first) / 2 swaps.
To see the source code, just look in STL header files for your system. On a Unix-like system, you probably need to look somewhere like `/usr/include/c++/4.1.2/bits/stl_algo.h`.
Problem
I wanted to know the time complexity of the next_permutation function. Can I view its code too ?