Re: set intersection -> true/false



Oana wrote:
) i think i'll just copy the STL source code for set-intersection and
) modify it (for me) to stop after first occurence.. I have these 2 sets
) - (ordered; unique lists), i iterate through both; iterators just go
) further when they are smaller than the other one, simetrically, and if
) equal, return true instead of storing in the third iterator. Then one
) goes just one time through the sets.

Are the sets ordered then ? In that case, your approach is indeed
the best way. I was thinking about unordered sets.

) With maps i still don't see how to make the comparison...but thanks
) again.

Stick one array in the map. Walk through the other array and see
if any element is in the map.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
.



Relevant Pages

  • Riemann surface for iteration of complex map?
    ... I once had a thread here where I mentioned the idea of using a Riemann ... surface to "continuously iterate" a complex map: ... real and theta any real. ...
    (sci.math)
  • Re: use remove_if in map
    ... RemoveInvalid(std::setvalidset) ... valid map elements into another map (possibly via a vector, ... log m) where s is the size of the valid set, and m that of the map. ... Option 2 is to iterate over the map and check each element for validity. ...
    (microsoft.public.vc.stl)
  • Why is not "sub" necessary? What is the difference: block and expression?
    ... I'm trying to understand the map function in perl and have been studying ... When David calls his iterate function, why does he not need to use the ... keyword "sub"? ...
    (perl.beginners)
  • Re: Collection
    ... The purpose of a Map is to hold associations; using a Map as a List is overkill. ... If, OTOH, you do need the associative lookup and only occasionally need to loop through the entrySet, then just iterate over the entrySet. ... It is unlikely that you actually need both Mapness and sortedness. ...
    (comp.lang.java.programmer)
  • Re: Using non-integers as an array index
    ... Is a map basically a table with an integer index and a key ... original inquiry about an array. ... I mentioned the TreeMap only because it allows you to iterate over the ... Steve W. Jackson ...
    (comp.lang.java.programmer)