## Invitation to Computer Science 8th Edition

The condition "while $(i \leq n)$" indicates that every single element of the list is going to be compared to the value of the largest so far. The comparison occurs here: $I f A_{i}>$ largest so far. It will be true only if the element analyzed is larger than the largest so far, in which case its value will be assigned to the largest so far. This means that even if we encounter the same value as the number already stored as the largest so far it won't take it into account since it would be equal to it, not larger. The conclusion is that even if the largest number occurs more than once, we will already have stored it after its the first occurrence.