1. INPUT: list A
2. max_idx = 0
3. max_elem = A[0]
4. n = length(A)
5. FOR i in [1,n-1]:
6. IF A[i] > max_elem:
7. max_elem = A[i]
8. max_idx = i
9. RETURN max_idx
Case 1: \(\verb|A[i]| >
\verb|max_elem|\)
\[\begin{equation}
\begin{array}{l l l}
1. & \forall k, 1 \leq k < i, \exists \verb| max_idx| \in
[0,k-1], \textrm{ and } \forall j \in [0,k-1], \verb|A[max_idx]| \geq
\verb|A[j]|
& \textrm{Ind. Hypothesis}\\
2. & \exists \verb| max_idx| \in [0,i-2], \textrm{ and }
\forall j \in [0,i-2], \verb|A[max_idx]| \geq \verb|A[j]| &
\textrm{Ind. Hypothesis with } k = i-1 \\
3. & \verb|A[i] > max_elem| & \textrm{Case 1}\\
4. & \verb|max_elem = A[i]| \land \verb|max_idx = i| &
\textrm{Defined in code lines 4-6}\\
5. & \forall j \in [0,i-1], \verb|A[max_idx]| \geq \verb|A[j]|
& \textrm{Combined 2, 3, and 4}
\end{array}
\end{equation}\]