When sorting....Everything is sorted except the firts element BUT WHY amd HOW DO I FIX??????
Code:
int partition(vector<string>& word_vector, int start, int stop)
{
string x;
int i,j;
x = word_vector[stop];
i = start-1;
for(j = start; j<= stop - 1; j++)
{
cout << "Start: " << start << endl;
if (strcmp(word_vector[j].c_str(),x.c_str())<=0)
{
i = i + 1;
swap(word_vector[i],word_vector[j]);
}
}
swap(word_vector[i+1],word_vector[stop]);
return i;
}
void quicksort(vector<string>& word_vector, int start, int stop)
{
int pivot;
if(start < stop)
{
pivot = partition(word_vector, start, stop);
quicksort(word_vector, start, pivot-1);
quicksort(word_vector, pivot+1, stop);
}
}