Sunday, July 4, 2010

Interesting Problem 5 : Trees

Q.5 Consider the following sequence of keys

(5,16,22,45,2,10,18,30,50,12,1)

Consider the insertion of items with this set of keys, in the order given, into :

a. An initially empty (2,4) tree T’

b. An initially empty red black tree T’’


My solution :





1 comment:

  1. I don't think that's right for the RBTree. I got 16 as the root, but 5 and 22 are the next level. Followed by 2, 10 under 5 ... then 18, and 45 under 22.

    ReplyDelete