¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
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 Respuesta
+ 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!