Question: Here is the pseudocode for the divide and conquer algorithm for the maximum contiguous sum with a print statement added: function mes ( A ,

Here is the pseudocode for the divide and conquer algorithm for the maximum contiguous sum
with a print statement added:
function mes(A,L,R)
if L=R
return(A[L])
else
C=L+R??2
Lax=mct(A,L,C)
Rax=mes(A,C+1,R)
Lhas =-infinity
Lhsum =0
for i - C downto L inclusive
Lhsun = Lhsun + A[i]
if Lhsum > Lhnax
Lhnax - Lhsun
end
end
Rhnax =-infinity
Rhsum =0
for i=C+1 to R inclusive
Rhaun = Rhsun + A[i]
if Rhsum > Rhnax:
Rhnax - Rhsun
end
end
Snax = Lhnax + Rhnax
print (Lmax +",+ Smax +","+ Rnax)
end if
end function
Suppose this code is run on a list of length 8 with the following incomplete output where we've
replaced some output by variables.
=1,1,2
0,4,4
2,a,b
=1,2,3
8,10,2
c,d,10
e,18,13
18
(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?
 Here is the pseudocode for the divide and conquer algorithm for

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!