From: Mike Furr <furr@cs.umd.edu>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] More efficient implementation of intersection of sets?
Date: Wed, 02 Apr 2008 11:34:23 -0400 [thread overview]
Message-ID: <47F3A77F.80508@cs.umd.edu> (raw)
In-Reply-To: <20080401155524.F1CE08B34A@xprdmxin.myway.com>
sasha mal wrote:
> Currently,
>
> Set.inter x y
>
> splits y into two trees, one containing elements that are bigger and
> the other containing elements that are smaller than the top of x,
> then applies the procedure recursively. What is the exact runtime of
> the algorithm? Is there a better one for the intersection for OCaml
> sets?
The general algorithm is linear in the size of both sets in the worst
case, however it can be quite a bit faster in many circumstances. See
the paper "Implementing Sets Efficiently in a Functional Language" by
Stephen Adams[1] for a more detailed discussion. I haven't looked at
INRIA's exact implementation very closely, so they may do some extra
tricks not discussed there, but it certainly appears to use this general
technique.
-Mike
[1] - http://citeseer.ist.psu.edu/162336.html
next prev parent reply other threads:[~2008-04-02 15:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-01 15:55 sasha mal
2008-04-01 23:42 ` [Caml-list] " Jon Harrop
2008-04-02 14:05 ` Frédéric Gava
2008-04-02 15:34 ` Mike Furr [this message]
2008-04-02 13:30 sasha mal
2008-04-02 14:01 sasha mal
2008-04-04 17:27 ` Brian Hurt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47F3A77F.80508@cs.umd.edu \
--to=furr@cs.umd.edu \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox