title: merge sort on array of strings
body: <p>I am trying to sort an array of strings using merge sort algorithm.I wrote this code and it works for arrays of integers but surprisingly for array of strings does not!It seems that it just sorts second part of array.I have no idea what piece is wrong in this code! I will be appreciated for your help.</p>
  
  <p><pre>
  <code></p>
  
  #include &lt;iostream&gt;
  #include &lt;list&gt;
  #include &lt;string&gt;
  using namespace std;
  
  void MergeSortA(int low , int high);
  void MergeA(int low ,int mid ,int high);
  
  string currentArray[5];
  int main()
  {
      for(int i = 0; i &lt; 5; i++)
          cin &gt;&gt; currentArray[i];
  
      MergeSortA(0,4);
  
      for(int i = 0; i &lt; 5; i++)
          cout &lt;&lt; currentArray[i] &lt;&lt;endl;
  
      return 0;
  }
  
  void MergeSortA(int low , int high)
  {
      int mid = 0;
      if(low &lt; high)
      {
          mid = ((low+high)/2);
          MergeSortA(low , mid);
          MergeSortA(mid+1,high);
          MergeA(low,mid,high);
      }
  }
  void MergeA(int low ,int mid , int high)
  {
      int i = low, j = mid+1 , k = low;
      string Temp[5];
  
      while(i &lt;= mid &amp;&amp; j &lt;= high)
      {
          if( currentArray[i] &lt; currentArray[j] )
          {
              Temp[k].assign(currentArray[i]);
              i++;
          }
          else
          {
              Temp[k].assign(currentArray[j]);
              j++;
          }
          k++;
      }
      if(i &gt; mid )
      {
          for(int h = j ;h &lt;= high ; h++ )
          {
              Temp[k].assign(currentArray[h]);
              k++;
          }
      }
      else
          for(int h = i; h&lt;= mid ; h++ )
          {
              Temp[k].assign(currentArray[h]);
              k++;
          }
     for(int i = 0; i &lt;= high ; i++)
     {
         currentArray[i].assign(Temp[i]);
     }
  }
  </code></pre>