Maximum triangle path sum: Difference between revisions

Content deleted Content added
Rdm (talk | contribs)
Rdm (talk | contribs)
Line 627: Line 627:
However, this turns out to be a slightly slower approach, because we are doing a little more work for each row.
However, this turns out to be a slightly slower approach, because we are doing a little more work for each row.


(Note that the cost of padding every row to the same width averages out to an average 2x cost in space and time. So what we are saying here is that the interpreter overhead for changing the size of the memory region used in each operation with each row winds up being more than a 2x cost. You can of course beat that using compiled code, but of course the cost of compiling the program will itself be more than 2x - so not worth paying in a one-off experiment. You wind up with similar issues in any system involving one-off tests.)
(Note that the cost of padding every row to the same width averages out to an average 2x cost in space and time. So what we are saying here is that the interpreter overhead for changing the size of the memory region used in each operation with each row winds up being more than a 2x cost. You can probably beat that using compiled code, but of course the cost of compiling the program will itself be more than 2x - so not worth paying in a one-off experiment. You wind up with similar issues in any system involving one-off tests.)


=={{header|Java}}==
=={{header|Java}}==