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

25th Feb 2017, 2:45 AM
ggg
1 ответ
+ 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!
25th Feb 2017, 6:22 AM
Michael Szczepanski
Michael Szczepanski - avatar