There is similar question about hash (dictionaries) and lists, also there is a good piece of info here: http://wiki.python.org/moin/TimeComplexity
But I didn't find anything about tuples.
The access time for
data_structure[i]
What about tuple? Is it O(n) like for a linked list or O(1) like for an array?
It's O(1) for both list and tuple. They are both morally equivalent to an integer indexed array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With