4

How are these two types of trees equivalent?

oneiros
  • 3,527
  • 12
  • 44
  • 71

2 Answers2

5

Wikipedia has this to say on the subject.

2-3-4 trees are an isometry of red-black trees, meaning that they are equivalent data structures. In other words, for every 2-3-4 tree, there exists at least one red-black tree with data elements in the same order. Moreover, insertion and deletion operations on 2-3-4 trees that cause node expansions, splits and merges are equivalent to the color-flipping and rotations in red-black trees. Introductions to red-black trees usually introduce 2-3-4 trees first, because they are conceptually simpler.

If you would like a more specific answer, you are welcome to ask a more specific question.

Chris Hannon
  • 4,134
  • 1
  • 21
  • 26
2

You can convert 2-3-4 trees to red black tree by introducing a red node for 3 child one and 2 red nodes for 4 child one. The resulting tree will be binary tree. So in this way 2-3-4 tree is kind of equivalent to red black tree.

Ankush
  • 2,454
  • 2
  • 21
  • 27