Algorithm 1 Random Search

Input: An array AA of size nn and an element xx

Output: The index of xx in AA or 1-1 if xAx \notin A

1:Let PP be an empty array of size nn with all zeros.

2:c=0c = 0

3:while cnc \ne n do

4:i=i = Random(1,n1, n)

5:if A[i]=xA[i] = x then

6:return ii

7:end if

8:if P[i]=0P[i] = 0 then

9:P[i]=1P[i] = 1

10:c=c+1c = c + 1

11:end if

12:end while

13:return 1-1