A Common-Sense Guide to Data Structures and Algorithms, Second Edition by Jay Wengrow @jaywengrow
Hi,
in the book, to page 467, you say:
In good greedy fashion, we save this profit in a variable called greatest_profit
.
But I think the correct variable would be potential_profit
instead.
Is it right? Many Thanks!
Hi!
I think that the variable greatest_profit is correct as stated. I agree, though, that the variable naming here can be slightly confusing, since even the greatest_profit is technically storing the greatest “potential” profit while the algorithm runs. However, by the time the algorithm has completed running, the greatest_profit variable should contain the actual greatest profit.
Thanks,
Jay
1 Like