Time Complexity of String Operations
Terry Reedy
tjreedy at udel.edu
Tue Jul 22 01:37:04 EDT 2008
youtoo wrote:
> 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?
There is a Py wiki page on such issues. A wiki search should find it.
More information about the Python-list
mailing list