loading...

re: Understanding Time complexity - Big O Notation VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I see what you're trying to say here, what I meant was O(1) is that constant time. O(n), where n completely depends on the number of items. I see ...
 

Well, since you have to iterate through the array, the time complexity is dependent on the number of items, therefor it's O(n) and not O(1). Getting values from a hash map is approaching O(1), perhaps that's the source of your confusion.

code of conduct - report abuse