English 中文(简体)
Python3 标准类型/数据结构的计算/记忆复杂性(清单、命令、图例等)
原标题:Python3 Computational/Memory Complexity of standard types/datastructures (list,dict,tuple etc)

Python3 默认数据结构( 列表、 dict、tuple...etc) 的计算复杂性是什么?

(记忆中的复杂问题也很有意思。 )

我发现:http://wiki.python.org/moin/TimeComplexity ----恐怕是关于python 2的,不是吗?

最佳回答

计算的复杂性与 < / em> 解决 < / em > 的< em> 路径有关。 独立地说, 如果 Python 3 速度更快或不快, 复杂性将是相同的 -- 除非用原则上不同的算法解决不了问题。

有时,同名的抽象数据结构可能有所不同(Python 2 字符串对 Python 3 字符串或 Int, 长于 Python 2 和 Python 3 的通用字符串)。

我没有检查过,但我猜Python 2和Python 3在这种意义上没有不同。

问题回答

维基条目适用于 Python 2 和 3. 的 CPython 条目 。 这些类别没有改变。 其他执行可能不同, 但是如果他们希望人们将代码从 CPython 移植到 xpython, 它们必须相似 。 例如, 使用列表类型链接列表的 Python 将需要一个相当不同的编程符号和代码重新排列来运作良好 ; - ) 。

在3.3中,对单项类进行了修改,以便共享一个类多个实例的'em>dict

更重要的是,(unicode)字符串类(unicode)已经完全改写,只使用所需的数个字节/字符。 结果一般会减少空间和时间,但主要效果应该是对被O(XXX)符号忽略的乘数的影响。





相关问题
Get webpage contents with Python?

I m using Python 3.1, if that helps. Anyways, I m trying to get the contents of this webpage. I Googled for a little bit and tried different things, but they didn t work. I m guessing that this ...

What is internal representation of string in Python 3.x

In Python 3.x, a string consists of items of Unicode ordinal. (See the quotation from the language reference below.) What is the internal representation of Unicode string? Is it UTF-16? The items ...

What does Python s builtin __build_class__ do?

In Python 3.1, there is a new builtin function I don t know in the builtins module: __build_class__(...) __build_class__(func, name, *bases, metaclass=None, **kwds) -> class Internal ...

what functional tools remain in Python 3k?

I have have read several entries regarding dropping several functional functions from future python, including map and reduce. What is the official policy regarding functional extensions? is lambda ...

Building executables for Python 3 and PyQt

I built a rather simple application in Python 3.1 using PyQt4. Being done, I want the application to be distributed to computers without either of those installed. I almost exclusively care about ...

热门标签