Added and fixed Comments

This commit is contained in:
Bernhard Schoeffel 2025-03-31 14:56:13 +02:00
parent 79f0fc36fd
commit 364590c563

View File

@ -39,7 +39,7 @@ def max_sequence_2(z: MemoryArray):
return m, l, r
def _max_sequence_3_sub(z: MemoryArray, l: Literal, m: Literal, r: Literal):
# find max-sum from Middle to left (including on elem from right)
# find max-sum from Middle to left
linksMax = MemoryCell(MIN_VALUE)
sum = MemoryCell(0)
links = MemoryCell(l)
@ -50,7 +50,7 @@ def _max_sequence_3_sub(z: MemoryArray, l: Literal, m: Literal, r: Literal):
linksMax.set(sum)
links.set(i)
# find max-sum from Middle to right (inluding one elem from left)
# find max-sum from Middle to right
rechtsMax = MemoryCell(MIN_VALUE)
sum.set(0);
startRight = MemoryCell(1) + m
@ -114,6 +114,7 @@ def max_sequence_4(z: MemoryArray):
max.set(aktSum)
links.set(aktLinks)
rechts.set(i)
# if negative we start new Sum -> Restart must be better than continue
if aktSum < Literal(0):
aktSum.set(0)
aktLinks.set(MemoryCell(1) + i)