0
您能否告诉我在Python中的“itertools.permutation”模块中,permutations()
的复杂性是什么?itertools.permutations的复杂性
我正在练习和学习python,并感谢您的任何帮助。
您能否告诉我在Python中的“itertools.permutation”模块中,permutations()
的复杂性是什么?itertools.permutations的复杂性
我正在练习和学习python,并感谢您的任何帮助。
它是O(1),因为它只是返回一个对象,它的next
方法在每次调用时会返回不同的排列方式。参数permutations
的大小不会影响创建该对象所用的时间。
没关系,那么这个可迭代的解包复杂度是多少 – 0TTT0 2017-12-18 22:54:01
你必须研究[C的源代码](https://hg.python.org/cpython/file/e106d9368bff/Modules/itertoolsmodule.c#l2527)。 – 2014-11-14 22:20:24