Re: operation complexities of lists and dictionaries

2006-03-29 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > what are the time complexities of inserting / removing / checking if an > element is present in 1) a list and 2) a dictionary? > does anybody know? I assume in the list case, the element you want to operate on is in the middle of the list. In CPyt

Re: operation complexities of lists and dictionaries

2006-03-29 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > what are the time complexities of inserting / removing / checking if an > element is present in 1) a list and 2) a dictionary? Partly dependent on the implementation, of which there are several for Python (CPython, Jython, PyPy, and others). Which

Re: operation complexities of lists and dictionaries

2006-03-29 Thread Steven D'Aprano
On Wed, 29 Mar 2006 09:38:05 -0800, [EMAIL PROTECTED] wrote: > > hi, > i've just a simple question: > what are the time complexities of inserting / removing / checking if an > element is present in 1) a list and 2) a dictionary? > does anybody know? > thanks No no no, that's not the way to ask t

Re: operation complexities of lists and dictionaries

2006-03-29 Thread Caleb Hattingh
Hi Use the "timeit" module, like so: >>> from timeit import Timer >>> t = Timer('[i for i in range(1)]') # The string is code to execute >>> (for timing) >>> print t.timeit(100) # execute it 100 times and print the result 0.222389936447 I would appreciate it if you could present your resul

operation complexities of lists and dictionaries

2006-03-29 Thread [EMAIL PROTECTED]
hi, i've just a simple question: what are the time complexities of inserting / removing / checking if an element is present in 1) a list and 2) a dictionary? does anybody know? thanks -- http://mail.python.org/mailman/listinfo/python-list