title: Algorithm - the time complexity of deletion in a unsorted array
body: <p>Suppose there is a unsorted array A, and it contains an element x (x is the pointer of the element), and every element has a satellite variable k. So, we can get the following time complexity (for worst cases):</p>
  
  <p>If we want to <strong>Search</strong> for a particular K, then it costs O(n).</p>
  
  <p>if we want to <strong>Insert</strong> an element, then it costs O(1), because A just adds the element to the end. </p>
  
  <p>What if we know x, then <strong>Delete</strong> it from the array A?</p>
  
  <p>We have to <em>Search</em> for x.k first and get the index of x, then <em>Delete</em> x via its index in A, right? </p>
  
  <p>So for <strong>Delete</strong>, it costs O(n) too, right?</p>
  
  <p>thanks</p>