• edited by
19,142 views
45 45 votes

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.

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

  1. None of the above

8 Answers

Best answer
42 42 votes

(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$, its evident the $3$rd element i.e. $H$ should be selected for splitting (because after adding any key from the leftmost child node, $P$ becomes the $3$rd 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.

• edited by
11 11 votes
If we consider this just as B tree, order of tree is 4.

Because minimum degree is 2.

Then m/2 = 4, m =4. (As it is upper bound, m can not be 5, m = Order of tree.)

If we insert G leaf node B H I becomes B G H I. As we can have maximum 3 keys in any node, we split it. G Goes up !

Then root becomes G,L,P,U.

Then We need to split root. L becomes root.

Answer -> D
4 4 votes
option C

first of i will like to say why do we use a btree :to reduce the height of a tree to narrow down our search procedure ...so wont you tree to reduce the height if there is any possibility ..inserting G would cause the leaf node to split but we have a possibility to not increase the height by splitting the root .. the possibility is redistribution i.e the sibling of the leaf node we are spliiting is empty so why not use that empty slot to save a height increase
3 3 votes
Answer: C

After inserting G into the first child.

Option A: Involves splitting.

Option C: The second child has less than 2 keys and the first child is full. That means rotation can be done without affecting the root node. The rotation involves pushing I into the second child. Now the first child is BGH and the second child is IN.

Option C is more apt here.
0 0 votes
b is the corect ans

when ever u instert an in ele g it is out of capacity so we push middle h into root then root also going out of capacity so me take middle ele and we form a root p

in option a first first 2 ele is pushed and in root 3rd ele is pushed
Answer:
Position:
Show:

Related questions

61 61 votes
5 answers 5 answers
14.7k
14.7k views
Kathleen asked Sep 17, 2014
14,685 views
A program consists of two modules executed sequentially. Let $f_1(t)$ and $f_2(t)$ respectively denote the probability density functions of time taken to execute the two ...
67 67 votes
11 answers 11 answers
21.1k
21.1k views
Kathleen asked Sep 17, 2014
21,055 views
Consider three data items $D1, D2,$ and $D3,$ and the following execution schedule of transactions $T1, T2,$ and $T3.$ In the diagram, $R(D)$ and $W(D)$ denote the action...
65 65 votes
9 answers 9 answers
23.7k
23.7k views
Kathleen asked Sep 17, 2014
23,673 views
Consider the following functional dependencies in a database.$$\begin{array}{|l|l|}\hline \text{Date_of_Birth } \to \text{Age} & \text{Age } \to \text{Eligibility} \\\hli...
59 59 votes
6 answers 6 answers
15.8k
15.8k views
Kathleen asked Sep 16, 2014
15,783 views
Consider the following SQL querySelect distinct $a_1, a_2, …, a_n$from $r_1, r_2, …, r_m$where PFor an arbitrary predicate P, this query is equivalent to which of the fol...