Cost of list functions in Python

Viewed 24236

Based on this older thread, it looks like the cost of list functions in Python is:

  • Random access: O(1)
  • Insertion/deletion to front: O(n)
  • Insertion/deletion to back: O(1)

Can anyone confirm whether this is still true in Python 2.6/3.x?

5 Answers
Related