From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Why AVL-tree?
Date: Mon, 02 Jun 2014 18:57:54 +0200 [thread overview]
Message-ID: <538CAD12.2040104@inria.fr> (raw)
In-Reply-To: <1401716071976.85ecb8da@Nodemailer>
On 02/06/14 15:34, Andrew Herron wrote:
> It's different to some other languages I've seen, but then so is their
> decision to not use a tail recursive List.map. Each to their own, it's not
> hard to implement the alternative :)
Yes, we're stupid, of course.
Yoriyuki Yamagata originally asked:
> Just from the curiosity, why balanced binary trees used in Set and
> Map are AVL-trees, not their alternative, say, red-black trees? Is
> there a deep reason for it, or just a historical one?
At the time Set was written, no efficient algorithms for whole-set
operations (union, intersection, difference, etc) were known for
red-black trees. I'm not sure they are known today.
As for performance of insert/lookup operations, Jean-Christophe
Filliâtre has measurements showing that OCaml's 2-imbalance AVL trees
perform better than red-black trees. It all depends on your ratio of
insertions to lookups, of course. But the 2-imbalance trick makes a
big difference with textbook AVL trees.
- Xavier Leroy
next prev parent reply other threads:[~2014-06-02 16:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 13:21 Damien Guichard
2014-06-02 13:34 ` Andrew Herron
2014-06-02 15:06 ` Gabriel Scherer
2014-06-03 12:48 ` Yaron Minsky
2014-06-03 13:12 ` Gabriel Scherer
2014-06-03 13:37 ` Yaron Minsky
2014-06-03 13:41 ` Yoriyuki Yamagata
2014-06-02 16:57 ` Xavier Leroy [this message]
2014-06-02 21:16 ` Andrew Herron
2014-06-10 18:19 ` jonikelee
2014-06-10 18:51 ` Florian Hars
2014-06-10 19:52 ` Jonathan
2014-06-15 4:51 ` Lukasz Stafiniak
2014-06-15 14:01 ` Jonathan
2014-08-03 21:25 ` Diego Olivier Fernandez Pons
-- strict thread matches above, loose matches on Subject: below --
2014-06-02 18:23 Damien Guichard
2014-06-02 11:48 Yoriyuki Yamagata
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=538CAD12.2040104@inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@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