title: Implementing Quicksort Partition Algorithm with first element as pivot
body: <p>I am trying to implement Quick sort partition Algorithm with first element as pivot,  I have studied Quicksort with last element as pivot . Can someone please tell me where I am wrong in the following pseudocode ?</p>
  
  <pre><code>/* Taking first element of array as pivot and movig all elements 
  smaller than pivot left to pivot and greater tto its right */
  // L is leftmost index, R is rightmost index 
  
  Partition(A[],L,R) 
  {
      pivot = A[L]
      i = L-1
      for (j =L to R )
      {
          // If current element is smaller than or equal to pivot
  
          if (A[j] &lt;= pivot)
          {
              i++;    // increment index of smaller element
              swap A[i] and A[j]
          }
      }
      swap A[i + 1] and A[L])
      return (i + 1)
  }
  </code></pre>