1
  1. Suppose I am entering 3 elements into a top-down 2,3,4 tree. Would all the three elements go into root?
  2. For subsequent inserts would a 3rd element be inserted into a node only if its a leaf node (or into a node when a key kicked up when you encounter a 3 key node)
Foo
  • 4,206
  • 10
  • 39
  • 54

1 Answers1

0
  1. Yes, all the three elements would end up in root. Why? A node of 2-3-4 tree is broken only when it is full. When inserting three elements, the only node of the tree won't be full until the insertion of the third element.

  2. For subsequent inserts, not just third, even the second and first elements would be inserted in the leaf node only. It's been nicely outlined in the insertion pseudocode of 2-3-4 trees on Wikipedia.

displayName
  • 13,888
  • 8
  • 60
  • 75