Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
ac42
· 5y ago · 0 comments
I am not clear why the proof is so long. By induction, the first i elements are already smaller than the A[i], so it's essentially an unoptimised version of
for i: 0..n-1 A[i] = min(A[i:n])
Comments
[–]
areyousure
5y ago
After the first iteration of the loop (and every other one too), A[i] is the maximum of the array, not the minimum.
[–]
ac42
OP
5y ago
Oh crap, now I see it. Thanks!