title: Performance of priority queue using an ArrayList
body: <p>I'm currently working on a minimum priority queue that keeps itself sorted as items are added.  The suggested implementation has new items added to the end of a sorted ArrayList, and then working back through the list to find the items correct location.  So it swaps with each previous element in the list until the added item is in order.  </p>
  
  <p>The implementation I used before this method was suggested involved comparing through the sorted list, marking the index where the item was to be inserted and then using Java's add(int index, Object O) method instead of just adding to the end.</p>
  
  <p>I'm trying to understand the performance difference between the 2.  I understand that if I insert, all of the trailing indexes will have to be corrected (which is taken care of by the class method).  But is this really less efficient than swapping back through the list?</p>
  
  <p>Thanks in advance for any explanations</p>