So I have this algorithm that outputs the largest value of an array:
- Input: $A[1,\dots,n]$, $n\geq 1$
- Output: Largest value of an array
Maximum (A) m = A i = 1 while i < n if A[i+1] > A[i] m = A[i+1] i = i+1 return m
I have to prove this algorithm wrong and I'm confused how to do that, because to me the algorithm seems correct. Any advice on how to do this are very much appreciated.