data-structures

/ 4 min read

Fractional Nested Sets: Solving a 30-Year-Old Tree Problem with Floats

The Problem with Nested Sets If you've ever stored a tree in a relational database, you've probably encountered the Modified Preorder Tree Traversal (MPTT) pattern — also known as nested sets. It's Joe Celko's classic: every node gets a lft and rgt integer,