size、isEmpty、get、set、iterator 和 listIterator 操作都以固定时间运行。add 操作以分摊的固定时间 运行,也就是说,添加 n 个元素需要 O(n) 时间。其他所有操作都以线性时间运行(大体上讲)。与用于 LinkedList 实现的常数因子相比,此实现的常数因子较低。
那0(n)是什么意思,不懂啊。 呵呵... 别骂哦。菜鸟呢 

解决方案 »

  1.   

    O(n)表示对于集合中的每个元素,需要增加的时间量都是相同的。国外服务器租用商提醒您如果需要重新给集合分配内存,ArrayList的Add()方法就是O(n)。
    改变容量,需要复制列表,复制的时间随元素的增加而线性增加。
      

  2.   

    In computer science, the time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the size of the input to the problem. The time complexity of an algorithm is commonly expressed using big O notation, which suppresses multiplicative constants and lower order terms. When expressed this way, the time complexity is said to be described asymptotically, i.e., as the input size goes to infinity. For example, if the time required by an algorithm on all inputs of size n is at most 5n3 + 3n, the asymptotic time complexity is O(n3).这种表示算法时间复杂度的方法叫big O notation,表示一个算法所用的时间量
    它是舍弃了倍系数和低位项,因此此种表示法被称为近似描述(asymptotically)
    因为输入大小可以接近无限
    比如5n3 + 3n
    就是O(n3),是舍弃了乘系数5和低位项3n
      

  3.   

    时间复杂度  不过java 不怎么在意这东西
      

  4.   

    最简单的理解方法就是:假如我有n个数,要找出里面最大的数
    这样跑一遍 
    for(int i=0;i<n;i++)
    {}
    时间复杂度就是O(N),因为你只检索了所有的数一遍。
    但是如果这样
    for(int i=0;i<n;i++)
    {
       for(int j=0;j<n;j++)
       {   }
    }
    时间复杂度就是O(N*N)
      

  5.   

    这是算法中的大 O 表示法,呵呵。O(n) 表示该算法的处理时间与数据量成正比
    O(n^2) 表示该算法的处理时间与数据量成平方正比
    O(lgN) 表示该算法的处理时间与数据量成对数比,比如:折半查找
    O(1) 表示该算法的处理时间与数据量无关,是一个常数,比如,计算 1 加到 100,利用求和公式就可以直接算出来,而不需要循环遍历这 100 个数由此可见 O(1) 的效率是最高的