Open Greeshmanth1 opened 7 months ago
Incorporating runtime complexities in the documentation for the len() method offers clear insight and dispels potential confusion among users. Unlike the traditional len() method, which operates in O(n) time complexity, this implementation achieves O(1). This distinction is crucial for understanding the efficiency of this code.
Unlike the traditional len() method, which operates in O(n) time complexity What are you referring to?
Traditional len() method TC is O(n).
myList=[1,2,3,4,5,] print(len(myList)) #Output --> 5
In the above example the len() have O(n) complexity, But in your implementation it's just O(1). So i have added the TC in comments, so it can be helpful to the users to mention it.
I have updated the run time complexities for the "len()" methods.