I have the following code. The output currently I am receiving is not the expected output. The pseudocode I am trying to solve is described below.
for each i in 1 · · · N do
TEi = fmob(Li)
TCi= fc(Li)
TUi =fd(Li)
return

Python code
def optimal_partition():
TE=[10,1,3]
TC=[2,3,1]
TU=[2,3,1]
N = len(TU)-1
SUMS = [0] * N
for j in range(N):
for i in range(1, j + 1):
SUMS[j] += TE[i]
for k in range(j - 1, N + 1):
SUMS[j] += TC[k]
SUMS[j] += TU[j]
return SUMS.index(min(SUMS))
For the above code, I need the expected output to be [16,15]. Thanks, help is highly appreciated.
SUMSshould have 3 values in it (j = 1..3, or when we use zero-based indexing, j = 0..2), not 2 values as you currently have.