Q. An, array, A comprises of n unique integers from the range x to y(x and y inclusive where n=y-x). Which means, there is only one member that is not in A. Design an O(n) time algorithm to find that number.
Ans:
The algorithm to find the number that is not array A where n contains n
unique (n = x - y):
find(int A[],n,x,y)
{
int i,missing_num,S[n]; for(i=0, i
{if(S[i] == -999)
{
missing_num = i + x;
break;
}
}
}