title: Quicksort confusion
body: <p>I'm going through the quicksort and whichever article i see, i get more confused.</p>
  
  <p>1) This implementation is really good <a href="http://gauss.ececs.uc.edu/Courses/C321/html/quicksort.java.html" rel="nofollow">http://gauss.ececs.uc.edu/Courses/C321/html/quicksort.java.html</a></p>
  
  <p>But as i understand, after each pass, the pivot index is in correct position.</p>
  
  <p>Then ideally we should be doing the following:</p>
  
  <pre><code>   public static void Quicksort(int A[], int f, int l)
     {
        if (f &gt;= l) return;
        int pivot_index = partition(A, f, l);
        Quicksort(A, f, pivot_index-1); //*** pivot_index-1
        Quicksort(A, pivot_index+1, l);
     }
  </code></pre>
  
  <p>But tutorial uses <strong>Quicksort(A, f, pivot_index);</strong>.</p>
  
  <p>I'm 200% sure that making the change 'pivot_index-1' will not improve any performance or reduce the complexity; but just want to make if my understanding is correct.</p>
  
  <p>2) The implementation <a href="http://www.vogella.com/articles/JavaAlgorithmsQuicksort/article.html" rel="nofollow">here</a> works; but it doesn't place the pivot element at the correct position with each pass.</p>