2

Why do insertion and removing operations in 2-3 tree always have complexity of O(logn), is there a mathematical proof?

1 Answers1

1
  • When we insert a key at level , in the worst case we need to split + 1 nodes (one at each of the levels plus the root).
  • A 2-3 tree containing keys with the maximum number of levels takes the form of a binary tree where each internal node has one key and two children.
  • In such a tree = (2^(+1)) − 1 where is the number of the lowest level.
  • This implies that + 1 = log( + 1) from which we see that the splits are in the worst case log .
  • So insertion in a 2-3 tree takes at worst time.
  • Similarly we can prove that searches and deletions take time.
Andrei Suvorkov
  • 5,559
  • 5
  • 22
  • 48