[Tutor] calling a variable name

Ricardo Aráoz ricaraoz at gmail.com
Tue Oct 23 14:37:43 CEST 2007

Kent Johnson wrote:
> Bryan Fodness wrote:
>> Thank you.  This works well.  I am still trying to figure out the pros 
>> and cons of using an array, dictionary or list.
> Array is specialized, you probably want list or dict.
> Use list when you want a sequence of items indexed by sequential integers.
> Lists
> - preserve order
> - are fast for indexed lookup
> - are relatively slow (O(n)) for adding, deleting and searching (though 
> for small lists this should not be a consideration)

Are you sure they take O(n) for adding? I would have thought it would
take O(1).

More information about the Tutor mailing list