RunTime Complexity of ArrayList.contains function | Sololearn: Learn to code for FREE!

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

2/25/2017 2:45:15 AM

ggg

1 Answer

New Answer

+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!