Skip to main content

Easy Red-Black Trees

Posted by cayhorstmann on May 12, 2011 at 3:46 AM PDT

A red-black tree is a binary search tree with the following additional
properties:

Comments

<p>Great article!</p> <p>I did not found such a ...

Great article!
I did not found such a compreensive article about red-black trees, when looking for the algorithm a few months ago.

<p>&nbsp;I've discovered a couple of issues when teaching ...

I've discovered a couple of issues when teaching with so called "red black trees":
1. There isn't one type, some books use 2-3-4 trees (as demonstrated in this article) others use 2-3 trees.
2. In terms of simplicity look at Leftist Red-Black trees (http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf) they are REALLY SIMPLE.
3. Finally, when it comes to real world use, deletion can be a major issue (if you delete a lot in your trees and your trees are big). So I've been using skip lists instead, where maintenance is a bit more straightforward. (Also Java has ConcurrentSkipLists!!)