[英]what is the time complexity of std::next_permutation() function in c++?
我想知道next_permutation函數的時間復雜度。 我也可以查看它的代碼嗎?
見http://www.sgi.com/tech/stl/next_permutation.html :
線性。 最多(最后 - 第一)/ 2次互換。
要查看源代碼,只需查看系統的STL頭文件。 在類Unix系統上,您可能需要查看/usr/include/c++/4.1.2/bits/stl_algo.h
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.