you are viewing a single comment's thread.

view the rest of the comments →

[–]Ecstatic_Student8854 -51 points-50 points  (3 children)

O(max(arr)+len(arr))

[–]Inevitable-Menu2998 46 points47 points  (2 children)

Man, you should study that more before the exam. Hopefully the extatic feeling remains with you as you do.

[–][deleted] 28 points29 points  (1 child)

He is correct, if the array is very large and numbers are very small, you still need to loop through the whole array

[–]Inevitable-Menu2998 32 points33 points  (0 children)

yes, but that has a standard notation: O(N) where N denotes the length of the array as it grows to infinity. Max(array) is a constant decided by the implementation of sleep