caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Monniaux <David.Monniaux@ens.fr>
To: caml-list <caml-list@yquem.inria.fr>
Subject: tree balancing in Set and Map
Date: Sun, 22 Oct 2006 02:03:24 +0200	[thread overview]
Message-ID: <453AB54C.50201@ens.fr> (raw)

I wonder about something: the first balanced tree data structure 
described in algorithmics courses is generally the AVL tree, where the 
heights of the subtrees differ by at most 1. In Caml's implementation, 
they are allowed to differ by at most 2.

A quick analysis of the functions h1(n) and h2(n) governing the maximal 
height of a tree with n nodes with respectively maximal height 
differences of 1 and 2 shows that asymptotically h2(n) is about 1.25 
times h1(n).

Why this choice then? Was it easier to implement? Is there some hidden 
effect like rotations not being needed as often? How about some 
bibliographic references? :-)

(Yes, you may have guessed, I'm not an algorithmician.)


             reply	other threads:[~2006-10-22  0:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-22  0:03 David Monniaux [this message]
2006-10-22  0:15 ` [Caml-list] " 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=453AB54C.50201@ens.fr \
    --to=david.monniaux@ens.fr \
    --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;
as well as URLs for NNTP newsgroup(s).