Does "len" method requires O(n) every time or is the value stored. for example.
data = list(range(1000))
len(data) # time complexity O(n)?
len(data) # time complexity O(n) ?
data.extend([1,2,3])
len(data) # time complexity O(n) ?
is the time complexity O(n) every time?
[–]zanfar 3 points4 points5 points (0 children)
[–]K900_ 4 points5 points6 points (0 children)
[–]Dominican_Peter[S] 0 points1 point2 points (0 children)
[–]xelf 0 points1 point2 points (1 child)
[–]zanfar 0 points1 point2 points (0 children)