English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] how to calculate a "xor"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-12-06 (05:08)
From: Alan Post <apost@r...>
Subject: [Caml-list] Re: how to calculate a "xor"
In article <20031205200829.7e29a2c6.Damien.Pous@ens-lyon.fr>, Damien wrote:
> Given two sets A and B, I want to calculate A\B _and_ B\A.  The sets
> are represented by lists.
> without using an order to sort the lists, is there something better
> than the following (O(n^2)) ?

If you have a decent hashing function, you can get expected linear
time by putting the elements into hash tables.

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners