Guide to the Java ArrayList

特点

  • 存储的元素有序可重复
  • ArrayList built atop an array, which is able to dynamically grow and shrink as you add/remove elements.

This ArrayListhas the following properties:

  • Random access takes O(1) time(支持高效的随机元素访问)
  • Adding element takes amortized constant time O(1)
  • Inserting/Deleting takes O(n) time
  • Searching takes O(n) time for unsorted array and O(log n) for a sorted one

时间复杂度函数图像

猜你喜欢

转载自blog.csdn.net/weixin_37646636/article/details/131977730