首页 > 编程语言 > 详细

Time complexity of ArrayList in Java

时间:2015-03-27 12:41:55      阅读:301      评论:0      收藏:0      [点我收藏+]

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

 

Time complexity of ArrayList in Java

原文:http://www.cnblogs.com/miaoz/p/4371383.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!