caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* tree balancing in Set and Map
@ 2006-10-22  0:03 David Monniaux
  2006-10-22  0:15 ` [Caml-list] " Brian Hurt
  0 siblings, 1 reply; 2+ messages in thread
From: David Monniaux @ 2006-10-22  0:03 UTC (permalink / raw)
  To: caml-list

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.)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-22  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-22  0:03 tree balancing in Set and Map David Monniaux
2006-10-22  0:15 ` [Caml-list] " Brian Hurt

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).