Time Complexity of String Operations

youtoo you2000too at gmail.com
Tue Jul 22 05:31:59 CEST 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