Re: set intersection -> true/false
- From: oanacb@xxxxxxxxx (Oana)
- Date: 31 May 2005 08:21:30 -0700
Jon Harrop <usenet@xxxxxxxxxxxxxx> wrote in message news:<429b49ad$0$572$ed2619ec@xxxxxxxxxxxxxxxxxxxxxxxxxx>...
> This depends how the sets are implemented. STL sets are mutable balanced
> binary trees, for example. In OCaml, sets are immutable so computing set
> intersection is likely to be much faster (it is asymptotically faster).
>
> In OCaml, you could write a disjoint function something like this:
>
> let rec disjoint s1 s2 = match s1, s2 with
> Empty, t2 -> true
> | t1, Empty -> true
> | Node(l1, v1, r1, _), t2 -> match split v1 t2 with
> l2, false, r2 -> disjoint l1 l2 && disjoint r1 r2
> | l2, true, r2 -> false
thanks, but i'm still fighting with C++..
.
- References:
- set intersection -> true/false
- From: oanacb
- Re: set intersection -> true/false
- From: Jon Harrop
- set intersection -> true/false
- Prev by Date: Re: How to name variables in a program?
- Next by Date: Re: set intersection -> true/false
- Previous by thread: Re: set intersection -> true/false
- Next by thread: Re: set intersection -> true/false
- Index(es):