2

I searched extensively and can't figure out what the infinity sign is meant in this pseudocode. enter image description here

The code is taken from here, which has a detailed explanation of dynamic programming for the coin change problem.

5
  • 4
    stackoverflow.com/questions/7969500/…
    – user214290
    Apr 26, 2018 at 18:52
  • 4
    A useful property of infinity is that x < infinity for any real x. See answers in linked question.
    – user214290
    Apr 26, 2018 at 18:54
  • 1
    Please, post code. Not pictures of code. This is a site for software engineers, not photographers or painters. We want to copy&paste your code, not critique its use of color and perspective. Apr 28, 2018 at 16:32
  • 3
    "I searched extensively and cant figure out what the infinity sign is meant in this pseudocode." – It means "infinity". Apr 28, 2018 at 16:33
  • 1
    It means infinity...
    – user253751
    Jul 22, 2020 at 10:57

1 Answer 1

8

That line (3) is simply saying initialize the Minimum value to the highest feasible value. In pseudocode that is infinity. If min was UInt32 in real code, then min would be UInt32.Max.

In other words, start off min at a really high value, so when searching iteratively for progressively lower values (by comparing to the previous value), then the first value is something so high that the next value will always become the next min.

Not the answer you're looking for? Browse other questions tagged or ask your own question.