title: time complexity for java arrayList remove(element)
body: <p>I was trying to graph the Time Complexity of ArrayList's remove(element) method.
  My understanding is that it should be O(N), however, its giving me a O(1). Can anyone point out what i did wrong here?? 
      Thank you in advance.</p>
  
  <pre><code>   public static void arrayListRemoveTiming(){
      long startTime, midPointTime, stopTime;
      // Spin the computer until one second has gone by, this allows this
      // thread to stabilize;
      startTime = System.nanoTime();
      while (System.nanoTime() - startTime &lt; 1000000000) {
      }
      long timesToLoop = 100000;
      int N;
      ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
  
      // Fill up the array with 0 to 10000
      for (N = 0; N &lt; timesToLoop; N++)
          list.add(N);
  
      startTime = System.nanoTime();
      for (int i = 0; i &lt; list.size() ; i++) {
          list.remove(i);
  
          midPointTime = System.nanoTime();
          // Run an Loop to capture other cost.
          for (int j = 0; j &lt; timesToLoop; j++) {
  
          }
          stopTime = System.nanoTime();
  
          // Compute the time, subtract the cost of running the loop
          // from the cost of running the loop.
  
          double averageTime = ((midPointTime - startTime) - (stopTime - midPointTime))
                  / timesToLoop;
  
          System.out.println(averageTime);
      }
  
  
  }
  </code></pre>