Consider the following 2-3-4 tree (i.e., B-tree with a minimum degree of two)…

2003

Consider the following 2-3-4 tree (i.e., B-tree with a minimum degree of two) in which each data item is a letter. The usual alphabetical ordering of letters is used in constructing the tree.

image.png

What is the result of inserting G in the above tree ?

image.png

  1. A.

    A

  2. B.

    B

  3. C.

    C

  4. D.

    None of the above

Attempted by 43 students.

Show answer & explanation

Correct answer: B

(B) is the correct answer.

Once we add G, the leaf node becomes B G H I, since we can have only 3 keys. The node has to split at G or H, and G or H will be added to parent node.

Since P is the parent node in options 1 and 2, it is evident the 3rd element i.e. H should be selected for splitting (because after adding any key from the leftmost child node, P becomes the 3rd element in the node).

Now parent node becomes H L P U, select P as for splitting, and you get option B.

Hence, answer is B.

Explore the full course: Gate Guidance By Sanchit Sir