Algorithm 1
input[n] //input array of size n, containing n numbers
int output[n]; // Supporting array for our algo, initialized to 0
for(int i=0;i<n;i++)
output[input[i]]++; //using elements of input array as index to create the o/p array
for(int i=0;i<n;i++)
{
if(output[i]==0) // If the ith element is zero, it means i wasn’t present in input array
cout<<i; // display i
}
Algorithm 2 << My favourite
traverse the list for i= 1st to n+2 elements
{
check for sign of A[abs(A[i])] ;
if positive then
make it negative by A[abs(A[i])]=-A[abs(A[i])];
else // i.e., A[abs(A[i])] is negative
this element (ith element of list) is a repetition
}