Question: Need help completing QuickSort function which calls my partiton function getting wrong output; input file contains AbracadaBra OUTPUT should be: 10 7 0 3 5
Need help completing QuickSort function which calls my partiton function
getting wrong output;
input file contains "AbracadaBra"
OUTPUT should be:
10 7 0 3 5 8 1 4 6 9 2
Need to do:

REFERENCE code:

---------------------------------------------------------
my code so far:
#include
void readFromFile(string &S, string filename); void convertToLower(string &S); bool lessThan(const string &S, int first, int second, int pass); int partition(const string &S, vector
int main(int argc, char *argv[]) { string S; string filename = argv[1]; vector quicksort(S,index,low,high); for(int k=0; k cout void readFromFile(string &S, string filename) { string buffer; ifstream ifile; ifile.open(filename); while (getline(ifile, buffer, ' ')) { string Stemp; Stemp = buffer; S = S+Stemp; } } void convertToLower(string &S) { transform(S.begin(), S.end(), S.begin(), ::tolower); } int partition(const string &S, vector while (i=low && lessThan(S,indices[j] ,pivot, 0) == false ){ j--; } if(i } swap(indices[high],indices[i]); return i; } bool lessThan(const string &S, int first, int second , int pass) { if(S[first] S[second]){ return false; } else //return T OR F return lessThan(S, first+1, second+1,0); } int quicksort(const string &S,vector } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
