How are red-black trees isomorphic to 2-3-4 trees?

I have a basic understanding of both red black trees and 2-3-4 trees, and how they maintain a height balance to make sure the worst case operations are O (n logn).

But I can not understand this text from Wikipedia

2-3-4 trees is an isometry of red-black trees, which means they are equivalent data structures. In other words, for every 2-3-4 trees, there is at least one red-black tree with data elements in the same order. Moreover, insert and delete operations on 2-3-4 trees that cause decompositions, breaks and merges w630> are equivalent to flipping and turning in red-black trees.

I do not see how operations are equivalent. Is this quote on Wikipedia accurate? How can you see that operations are equivalent?

+5
source share
1 answer

rb-tree (red-black tree) is not isomorphic to a 2-3-4 tree. Since the 3-node in the 2-3-4-tree can be tilted left or right, if we try to match this 3-node with the rb-tree. But llrb-tree (left red-black tree) does.

Words from Robert Sedgwick (section Introduction):

In particular, the paper describes a way to maintain 
a correspondence between red-black trees and 2-3-4 trees, 
by interpreting red links as internal links in 3-nodes and 
4-nodes.  Since red links can lean either way in 3-nodes 
(and, for some implementations in 4-nodes), the correspondence is not necessarily 1-1

Also Page 29 and Page 30 of presentation by Robert Sedgewick. This is a presentation about the LLRB tree.

And the section "Analogy to B-trees of order 4" in the "Red-black tree" in wikipedia , it contains a good graphic.

+5
source

All Articles