Exploring the design space of binary search trees

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • ext-ds

    An extension providing efficient data structures for PHP 7

  • I started this project many years ago when I was coming up with ideas for immutable data structures for the PHP data structures extension: https://github.com/php-ds/ext-ds. I wanted to support access by position in a sorted set, which led to the idea of using binary search trees for both lists and sets. However, I did not expect the scope of this project to increase as much as it did.

    The more I read about binary search trees, the more I thought about them, and so down the rabbit hole I went.

  • bst

    Well Factored, Non-Recursive, General & Generic BSTs in ANSI C (by c-blake)

  • If you like this article then you might also be interested in: https://github.com/c-blake/bst interesting

    It's ANSI C with a bespoke macro generics system not Go, does not cover as many balancing rules, and is not written up as nicely. It does do something only weakly represented in your Go impls, AFAICT - "binary symmetry" - the reflection about left-right intrinsic to most ideas in this area. (Mehlhorn has a book that does this, but that is the only other source I know.) It also has API considerations like seek-edit separation and how to handle in-tree duplicate key FIFO/LIFO/etc (as opposed to values which are also collections).

    Also, Re: B-trees among several comments - edit heavy B-trees with large nodes (driven by IO bandwidth-delay products) need some "mini-scalable" structure for their nodes since shifting (on average) half the entries can cost. That mini-scale could be another B-tree or it could be a binary search tree, perhaps adjusted to have 2-byte sized pointers into the little arena that is a node if 64Knode is enough. I once heard Sybase (now Microsoft SQL Server?) used skip lists. Anyway, this may be a remaining use case for binary trees even in the presence of a B-tree.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • bst

    Exploring the design space of binary search trees

  • Thank you for sharing this resource, I was not aware of it. I am happy to see the inclusion of LBSTs there too.

    Re: binary symmetry, if I'm understanding correctly, another author that makes use of the symmetry is Ben Pfaff in libavl [1]. At the top of [2], which seems a bit misplaced now, I wrote:

    > A choice was made to not unify the symmetric cases using the direction-based technique of Ben Pfaff and others because it makes the logic more difficult to follow even though there would be less code overall.

    The choice of Go was to provide implementations that are both reliable to benchmark (though not as robust as C or Rust for example) but also easy to read. I would like to further reduce abstraction by decomposing common parts such that all the strategies are "one-file" references. This is then effectively the opposite of what the macro-based implementation achieves. Both have value, of course.

    [1] https://adtinfo.org/libavl.html/BST-Node-Structure.html

    [2] https://github.com/rtheunissen/bst/blob/main/trees/avl_botto...

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Make your PHP arrays sweet'n'safe

    2 projects | /r/PHP | 23 May 2023
  • php-ds extension

    5 projects | /r/PHPhelp | 27 Dec 2022
  • Poll: usage of the Data Structures extension

    2 projects | /r/PHP | 9 Dec 2022
  • Weekly "ask anything" thread

    3 projects | /r/PHP | 13 Mar 2022
  • Create 3D models using PHP

    9 projects | /r/PHP | 6 Jun 2023