0
RunTime Complexity of ArrayList.contains function
In java.util.ArrayList data structure, the function contains has time complexity of O(n) or O(1)? I heard that java implement it in such way that it will be O(1) so if it true I'll be glad to know how it made like that. thanks
1 Resposta
+ 1
I feel its highest possibility would be n but I think it just searches from start to finish. im sir you can look at the javadocs to find out!