Is len O(n) or O(1) ?
Fredrik Lundh
fredrik at pythonware.com
Thu Sep 11 05:34:16 EDT 2008
More information about the Python-list mailing list
Thu Sep 11 05:34:16 EDT 2008
- Previous message (by thread): Is len O(n) or O(1) ?
- Next message (by thread): Is len O(n) or O(1) ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
process wrote:
> Python uses arrays for lists right?
len is O(1). for other operations, see
http://effbot.org/zone/python-list.htm#performance
> def quicksort(lista):
> if lista == []:
> lista
better make that:
def quicksort(lista):
if not lista:
return lista
...
</F>
- Previous message (by thread): Is len O(n) or O(1) ?
- Next message (by thread): Is len O(n) or O(1) ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list