we can use Boyer's Moore algo
int isSubset(int*mat,int p,int q,int*arr,int n)
{
int h;
h=hash(arr,n);
for(i=0;i<pq;i++)
{
if(h==hash(mat+i,n))
{
for(k=0;k<n;k++)
{
if(arr[k]!=*(mat+i+k))break;
}
if(k==n)return 1;
}
}
}
What do u think ? Suggest improvements and mistakes :)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.