Question: Here is the pseudocode for the divide and conquer algorithm for the maximum contiguous sum with a print statement added: function m c s (
Here is the pseudocode for the divide and conquer algorithm for the maximum contiguous sum
with a print statement added:
function
if
return
else
Lmax
Rmax
Lhmax infinity
Lhsum
for downto inclusive
Lhsum Lhsum Ai
if Lhsum Lhmax
Lhmax Lhsum
end
end
Rhmax infinity
Rhsum
for to inclusive
Rhsum Rhsum
if Rhsum Rhmax:
Rhmax Rhsum
end
end
Smax Lhmax Rhmax
print Lmax Smax Rmax
end if
end function
Suppose this code is run on a list of length with the following incomplete output where we've
replaced some output by variables.
a What was the original list? You do not need to know the values of the variables to answer
this.
b What are the values of the variables?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
