# Intersection of sublists of one array....

its a program in OPL language. we have to compare all the sub-strings of the array and print that is any intersection is happening between two of the sub-lists or not… but here a prob is showing that it is not accepting the if condition it is directly going to the else part… plzz anyone can solve this prob? and tell me that hoe could i find the common elements by comparing each sub-lists…

``````{int} R[1..n][1..m]= [  [{1,2,3,4}], [{7,2,3,9}], [{2,9,3,4}], [{2,14,3,16} ] ];
execute
{
for(var x=1; x<=n; x++)
{
for(var y=x+1;y<=n;y++)
{
if(R[x] == R[y])
{
for(var k=y;k<=n;k++)
R[k]= R[k+1];
writeln("array is not null");

}
else
writeln("a is  null");
}
}
}``````

Wait, when you use R[x]==R[y] , doesnt it compare like [{1,2,3,4}]==[{7,2,3,9}] (for x and y being 0 and 1 resp. ) And for this, since none of the list is exactly same, I think it will give else part.

What is the output when you place 2 identical list in it? Sorry, I am not familiar with this aspect/field yet, so can you give any Q link or any relevant information?

see opl is not a very popular language so there is not so much info regarding this…
and about the prob, yes it should be working like this [{1,2,3,4}]==[{7,2,3,9}] bt when m putting data such as [{1,2,3,4}]==[{1,2,3,4}] still it giving the else part as output six times…

bt i want to show that if any element between the substrings are common the it will print that array is not null i.e. there is some intersection value is there… such as [{1,2,3,4}]==[{7,2,3,9}], here 2,3 are common so it should print array is not null…