Site banner

Down with Red-Black Trees

Balanced trees an essential data structure that we learn early in a computer science curriculum. To become a computer programmer, you would learn to maintain a set of keys and values, maintaining order and uniqueness, with O(log N) time complexity.

Balanced trees are both important in the practical sense and important in the pedagogical sense. You probably learned the Red-Black Tree.

How I remember it, there we were, a class of mainly second-semester computer science majors, and the red-black tree was there to filter us out. And it did. Problem is, none of us learned a useful balanced tree data structure.

Later, I learned the deterministic skip list. You should too.

After learning skip lists, if you are so inclined, you are ready for a B-tree. They save a lot of memory compared with red-black trees, faster too! Here's that time I posted on the Google Open Source blog about this.