## Invitation to Computer Science 8th Edition

If $n = 1$, then largest so far is set to$A_{1}$, the only list element, and the location is set to 1. Also, $i$ is set to 2, so the while loop will not execute because it is false that $i \leq n$ (i.e., it is false that $2 \leq 1$). The correct values of largest so far and location are printed.
If $n = 1$, then largest so far is set to$A_{1}$, the only list element, and the location is set to 1. Also, $i$ is set to 2, so the while loop will not execute because it is false that $i \leq n$ (i.e., it is false that $2 \leq 1$). The correct values of largest so far and location are printed.