Red-Black Trees and 2-4 Trees

One way to think of red-black trees is as a representation of 2-4 trees. This demonstration shows the relationship: a red-black tree on the left corresponds to the 2-4 tree on the right. You can interactively add and remove items from the red-black tree and see the corresponding changes in the 2-4 tree:

You can back up or redo an operation using the “<<” and “>>” buttons. Tree nodes that become unreachable (“garbage”) fall out of the demonstration space.

Fast Slow

Value to insert: