I have this java function:
public int foo(ArrayList l, int n)
{
if(n <= 1)
return l.get(0);
if(l.get(0) < l.get(1))
l.remove(1);
else
l.remove(0);
foo(l, n-1);
}
So I figure to show that the algorithm is correct I would use an induction proof. However what I am not so sure about is how to go about doing the proof. Will I fist need to derive some sort of mathematical formula for this function and prove that?
fooexpected to do? We can only guess thatfoois searching for the minimum number. $\endgroup$