Tag: algorithm

python – Cost of len() function

The Question : 313 people think this question is useful What is the cost of len() function for Python built-ins? (list/tuple/string/dictionary) The Question Comments : The Answer 1 379 people think this answer is useful It’s O(1) (constant time, not depending of actual length of the element – very fast) on every type you’ve mentioned,