int k = n;
while (k > 0) {
for (int j=0; j < k*k; j++)
sum += data[j];
k = k / 4;
}
3 2 6 7 8 9 2 1 4 3
The goal is to find the largest section of array A that is also
a section of B. For example consider:
A: 3 2 6 7 8 9 2 1 4 3
B: 0 8 9 2 1 3 3 4 3 2 6 7 6 6
Here, the largest section of A that occurs as a section in B is the
section 8 9 2 1.
Now consider the method definition
Method: findSection (A, i, j, B)
Input: arrays A and B, indices i and j
(... fill in pseudocode here ...)
Output: true or false, depending on whether the section
i through j (inclusive) in A is a section in B
Write out the pseudocode for this method, assuming the most
straightforward way of solving the problem.
Then, write the pseudocode for
Algorithm: findLargestSection (A, B)
Input: arrays A and B
(... fill in pseudocode here ...)
Output: return the i,j range of the largest section of A
that is also a section in B, and where it occurs in B.
This algorithm should use the method findSection().
Analyze the overall time taken by findLargestSection(),
assuming both arrays are of similar size (n elements).
Submission: