let X be a random variable denoting number of comparisons made by the algorithm before terminates.
total number of permutations possible using the numbers present in the array = $\frac{5!}{2!}$ = 60(as x presents 2 times.and assume that other numbers are not repeated)
so, p(X=1)=$\frac{4!}{60}$=$\frac{24}{60}$
p(X=2)=$\frac{3*1*3!}{60}$=$\frac{18}{60}$
p(X=3)=$\frac{3*2*1*2!}{60}$=$\frac{12}{60}$
p(X=4)=$\frac{3!*1}{60}$=$\frac{6}{60}$
so expected no of comparisons=1*$\frac{24}{60}$+2*$\frac{18}{60}$+3*$\frac{12}{60}$+4*$\frac{6}{60}$
=2