c ++中的std :: next_permutation()函数的时间复杂度是多少? [英] what is the time complexity of std::next_permutation() function in c++?

查看:1501
本文介绍了c ++中的std :: next_permutation()函数的时间复杂度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道next_permutation函数的时间复杂度。我也可以查看其代码吗?

I wanted to know the time complexity of the next_permutation function. Can I view its code too ?

推荐答案

请参阅 http://www.sgi.com/tech/stl/next_permutation.html


线性。最多(最后一个)/ 2
交换。

Linear. At most (last - first) / 2 swaps.

要查看源代码,只需查看STL头文件为您的系统。在类Unix系统上,你可能需要查看 / usr / include / c ++ / 4.1.2 / bits / stl_algo.h

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.

这篇关于c ++中的std :: next_permutation()函数的时间复杂度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆