Time Complexity of String Operations

youtoo you2000too at gmail.com
Mon Jul 21 23:31:59 EDT 2008


It has been extensively discussed the time complexity (quadratic) of
string concatenation (due to string's immutability).
But what is:

== the time complexity of string indexing? Is it constant?
== the time complexity of string slicing? Is it O(K) with K the
slice's length?

How are strings stored in Python? As arrays? As linked lists?

Thanks a lot!

yt.



More information about the Python-list mailing list