title: Improving the Quick sort
body: <p>If possible, how can I improve the following quick sort(performance wise). Any suggestions?      </p>
  
  <pre><code>void main()
      {
        quick(a,0,n-1);
      }
  
      void quick(int a[],int lower,int upper)
      {
         int loc;
         if(lower&lt;upper)
         {
          loc=partition(a,lower,upper);
          quick(a,lower,loc-1);
          quick(a,loc+1,upper);
  
         }
      }
  
      /* Return type: int
        Parameters passed: Unsorted array and its lower and upper bounds */
  
      int partition(int a[],int lower,int upper)
      {
        int pivot,i,j,temp;
        pivot=a[lower];
        i=lower+1;
        j=upper;
        while(i&lt;j)
          {
              while((i&lt;upper)&amp;&amp;(a[i]&lt;=pivot))
              i++;
              while((a[j]&gt;pivot))
              j--;
              if(i&lt;j)
                  {
                      temp=a[i];
                      a[i]=a[j];
                      a[j]=temp;
                  }
  
          }//end while
  
          if(pivot&gt;a[j])
          {
               temp=a[j];
               a[j]=a[lower];
               a[lower]=temp;
          }
  
           return(j);
  
  }//end partition
  </code></pre>