I'm sure this is a really simple question but I can't seem to crack it. Prove the correctness of your algorithm; i.e. state its loop invariant and prove it by induction.
Below is my algorithm. I know how to do the second part (prove by induction) but I just cant figure out the loop invariant for the life of me.
procedure intersection(A,B: list of integers)
C= empty list
for i:=1 to n:
for j:= 1 to m:
if Ai = Bj
if Ai not in C
C.append(Ai)
return C