title: String quicksort in c++
body: <p>I'm trying to implement alphabet sorting using quick sort in c++ but I'm not able to do so :( </p>
  
  <p>Below is my code :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int partition(string &amp;str, int start, int end){
      int pivot = str[end-1];
      int i = start;
      for(int j=start; j&lt;end-1 ; j++){
          if(str[j]&lt;=pivot){
              swap(str[j], str[i]);
              i++;
          }
      }
      swap(str[i], str[end]);
      return i;
  }
  
  void quicksort(string &amp;str, int start, int end){
      if(start&lt;end){
          int pIndex = partition(str, start, end);
  
          quicksort(str, start, pIndex-1);
          quicksort(str, pIndex+1, end);
      }
  }
  int main()
  {
      int t,k, end, start;
      string str;
  
      cin&gt;&gt;t;
      for(k=0;k&lt;t;k++){
          cin&gt;&gt;str;
          end = str.size();
  
          quicksort(str, 0, end);
          for(int l=0; l&lt;end; l++){
              cout&lt;&lt;str[l];
          }
          cout&lt;&lt; "\n";
      }
  
  
      return 0;
  }
  </code></pre>
  
  <p>Please take a look at it and help me where I'm doing it wrong? :(</p>
  
  <p>Thanks in advance.</p>