Time complexity of ArrayList in Java

The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. All of the other operations run in linear time (roughly speaking). The constant factor is low compared to that for the LinkedList implementation.

 

Basically ArrayList is implemented by an Array. 

 

Reference:

Official API

StackOverflow

 

posted @ 2015-03-27 11:50  zmiao  阅读(213)  评论(0编辑  收藏  举报