Functional Pearl: Purely Functional 1−2 Brother Trees
Enter the computing arboretum and you will find a variety of well-studied trees: AVL trees, symmetric binary B-trees, Hopcroft's 2-3 trees, the bushy finger trees, and the colourful red-black trees. In this pearl, we look at a more exotic species of balanced search trees, 1-2 brother trees, which deserves to be better known. Brother trees lend themselves well to a functional implementation with deletion as straightforward as insertion, both running in logarithmic time. Furthermore, brother trees can be constructed from ordered lists in linear time. With some simple optimisations in place, this implementation of search trees is one of the fastest around. So, fasten your seat belts.