Time Complexity of finding the length of an array

Viewed 3876

I am a little confused on what the time complexity of a len() function would be.

I have read in many different posts that finding the length of an array in python is O(1) with the len() function and similar for other languages.

How is this possible? Do you not have to iterate through the whole array to count how many indices its taking up?

1 Answers
Related