list

I want a function or algorithm ot find similar elements in two or more lists (from STL).
for example:
list1 = a,d,t,e,b
list2 = t,k,p,w,e
and answer:
list3 = t,e

Thanks.
Last edited on
There may already be a function to do this, but here's some pseudo-code that should work:

1
2
3
4
5
6
7
8
for ( list1 range )
{
    for ( list2 range )
    {
        if ( list1[i] == list2[j] )
            save to list3 or something;
    }
}
Topic archived. No new replies allowed.