Question: given code: Function partition that takes as parameters(1) string S of size n, passed constant by reference (2) vector indices of integers of size n,

 given code: Function partition that takes as parameters(1) string S of

given code:

size n, passed constant by reference (2) vector indices of integers of

Function partition that takes as parameters(1) string S of size n, passed constant by reference (2) vector indices of integers of size n, where each integer is the starting position of a suffix in S; indices are passed by reference (3) integers low and high, the start and the end indices of a given range; and (4) an integer pivotindex, which is an arbitrary index of the vector indices int partition(const string &S, vectorint> &indices, int low, int high, int pivotindex) First, this function swaps indices[pivotindex] and indices[high], where high is the last index in the range Then, this function will partition suffix indices (use code of Partition provided in lecture notes as an example) so that the first half contains positions of suffixes that are less than suffix pivot and the second contains indices of suffixes that are greater than suffix pivot. This function will call the functions lessThan to accomplish this task. INPUT: abracadabra 4 OUTPUT: 0 1 8 3 10 5 74 2 9 6 INPUT: abracadabra1 OUTPUT 0 10 8 3 7 5 1 4 2 9 6 INPUT: Life what happens while we are making other plans. 6 OUTPUT: 46 43 2 3 4 41 49 7 37 9 10 11 36 32 14 30 29 17 27 26 25 23 22 6 24 2 19 18 28 16 15 31 13 33 34 35 12 8 38 39 40 5 42 1 44 45 47 48 21 int partition(vector &A, int low, int high){ int pivot -A[high]; int i - low, j - high - 1; while(i - low && A[j] > pivot) f (1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!