On 1/27/11 1:53 PM, Sturla Molden wrote:
But N appends are O(N) for lists and O(N*N) for arrays.

hmmm - that doesn't seem quite right -- lists still have to re-allocate and copy, they just do it every n times (where n grows with the list), so I wouldn't expect exactly O(N).

But you never know 'till you profile. See the enclosed code and figures.

Interestingly both appear to be pretty linear, though the constant is Much larger for numpy arrays.

-Chris









--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]

Attachment: append_time.py
Description: application/python

<<attachment: append_timing.png>>

_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to