Suppose that I have two lists of objects and I would like to match every object in list one with every object in list two.
This would probably be the algorithm that one would immediately come up with.
for( it_1=list_1.begin() ; it_1!=list_1.end() ; it_1++ )
{
for( it_2=list_2.begin() ; it_2!=list_2.end() ; it_2++ )
{
//now match
match(*it_1,*it_2);
}
}
I wonder if there is any better way of doing this. This requires O(n1*n2), where n1 and n2 are the length of list_1 and list_2, respectively.
You can make use of multi threading here by diving the list1 to 2 or 3 parts depending on the size and efficiency u r looking for , and run the match algorithm in each thread with list2 and collating the results back to the caller.
See if it helps..