Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have "Brodal search trees" really been implemented for practical use?

Brodal et al. demonstrated in their ESA '06 paper the existence of a purely functional structure with logarithmic-time search, update and insertion, and constant-time merge. (Note I'm not talking about Brodal heaps, which are a different data structure, quite widely used to implement purely functional priority queues.) This seems to be a very lucrative result, and should lead to efficient purely functional sets and maps, but I don't see them used anywhere:

  • Haskell's containers uses Adams trees;
  • OCaml standard library uses AVL trees;
  • Scala's immutable sorted maps are implemented using red-black trees.

If Brodal trees really have such good results, why have they not been adapted into mainstream functional programming languages standard libraries? In fact, I have not seen even one implementation of Brodal trees at all!

Specifically, is this because:

  • they are very hard (or in fact nearly impossible) to implement correctly;
  • the constants are very large, and real gains seem small;
  • other reasons;
  • or a combination of the aforementioned?
like image 543
xuq01 Avatar asked Dec 27 '18 12:12

xuq01


Video Answer


1 Answers

As mentioned in the comments there is very limited information in the paper, leading one to suspect very large constants, in addition:

  1. The structure doesn't actually claim to support general merge in O(1) time. It only claims to support a much more restricted join function concatenating trees that are sorted relative to each other. Given a way to split trees, this operation is useful for parallel computation, but in that context logarithmic join is quite cheap enough for any practical purpose.
  2. The structure doesn't support splitting at an element, and no efficient implementations are offered for unions, intersections, etc.

Somewhat overlapping with the above, reading the article I would think the following note from the conclusion may be why not much effort has been made toward implementation

Splitting will invalidate this property for every tree-collection and will lead to (log n log log n) search and update times.

like image 113
Dennis Jaheruddin Avatar answered Oct 08 '22 15:10

Dennis Jaheruddin