Question: I need help with this insertion sort function for my assignment. Here is the function declaration with the parameters: void insertion(const string &S, vector &indices,
I need help with this insertion sort function for my assignment.
Here is the function declaration with the parameters:
void insertion(const string &S, vector &indices, int low, int high)
An example of how the insertion function would work is that I pass in the string "abracadabra" with the low being 0 and high being 6
and the output would be :0 3 5 1 4 6 2 7 8 9 10

Here is my less than function that you need to use with the insertion function which is working.

Re-write Insertion sort algorithm to sort suffixes of a given string S. Similarly to QuickSort, your insertion function will take a string S (passed constant by reference), and a vector of integers with the starting positions of suffixes of S. The function will sort the suffixes of S in the range from low to high (inclusive indices of the range). Insertion will call lessThan function (from Assignment 5) and will swap positions of the suffixes instead of suffixes. Here is the header of this function: void insertion(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
