[Python-ideas] Run length encoding
Bernardo Sulzbach
mafagafogigante at gmail.com
Sat Jun 10 23:26:15 EDT 2017
More information about the Python-ideas mailing list
Sat Jun 10 23:26:15 EDT 2017
- Previous message (by thread): [Python-ideas] Run length encoding
- Next message (by thread): [Python-ideas] Run length encoding
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2017-06-11 00:13, David Mertz wrote: > Bernardo Sulzbach posted a much prettier version than mine that is a bit > shorter. But his is also somewhat slower (and I believe asymptotically > so as the number of equal elements in subsequence goes up). He needs to > sum up a bunch of 1's repeatedly rather than do the O(1) `len()` function. > Constructing a list from an iterator of size N is in O(N). Summing N elements is in O(N). I don't think it is asymptotically slower, just slower because of implementation details. -- Bernardo Sulzbach http://www.mafagafogigante.org/ mafagafogigante at gmail.com
- Previous message (by thread): [Python-ideas] Run length encoding
- Next message (by thread): [Python-ideas] Run length encoding
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list