caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Julien Signoles <julien.signoles@gmail.com>
To: caml-list@inria.fr
Subject: Fwd: [Caml-list] Balancing algorithm of Set/Map implementation
Date: Fri, 14 May 2010 10:09:10 +0200	[thread overview]
Message-ID: <AANLkTilFtpCbSdldWn1mo2cM7KQidoUvEfC_2SVbHMel@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikNr91FmeqOAXT-MOS0yDgH652WMvsg0a-WopKN@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

Sorry miss the Cc-ing to the caml list.

---------- Forwarded message ----------
From: Julien Signoles <julien.signoles@gmail.com>
Date: 2010/5/14
Subject: Re: [Caml-list] Balancing algorithm of Set/Map implementation
To: Yoriyuki Yamagata <yoriyuki.y@gmail.com>


Hello,

2010/5/14 Yoriyuki Yamagata <yoriyuki.y@gmail.com>

> When I read the balancing function of stdlib's Set/Map several years ago, I
> thought I have understand how it works.  But now, I read it again and I'm
> less confident now.  Could someone answer my questions?
>
> Is this code right?  If r is Empty and lr and ll are huge trees,
>
> doesn't it create a massively unbalanced tree?
>
> Another question is that why OCaml implementation allows
> a balancing factor up to *2*, which is usually allowed only up to 1?
>
>
> Maybe my question is naive one, but I would appreciate if your could comment it.
>
>
Some years ago, Jean-Christophe Filliâtre and Pierre Letouzey formally
proved within the Coq proof assistant (http://coq.inria.fr) that this
algorithm is correct. Explanations provided by their paper [1] should answer
your 2 questions.

[1] Jean-Christophe Filliâtre and Pierre Letouzey. Functors for Proofs and
Programs. In *Proceedings of The European Symposium on Programming*, volume
2986 of *Lecture Notes in Computer Science*, pages 370-384, Barcelona,
Spain, April 2004.

Hope this helps,
Julien Signoles

[-- Attachment #2: Type: text/html, Size: 2079 bytes --]

  parent reply	other threads:[~2010-05-14  8:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14  6:17 Yoriyuki Yamagata
     [not found] ` <AANLkTikNr91FmeqOAXT-MOS0yDgH652WMvsg0a-WopKN@mail.gmail.com>
2010-05-14  8:09   ` Julien Signoles [this message]
2010-05-14 13:02 ` [Caml-list] " Daniel Bünzli
2010-05-14 15:13 ` Goswin von Brederlow
2010-05-14 18:48 ` "Stanisław T. Findeisen"

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=AANLkTilFtpCbSdldWn1mo2cM7KQidoUvEfC_2SVbHMel@mail.gmail.com \
    --to=julien.signoles@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).