GATE Computer ScienceVery hardGATE CS
A B-tree with minimum degree t = 3 (every node except the root has between 2 and 5 keys) is built with the CLRS insertion procedure, which splits any full node (5 keys) it meets on the way down before descending. Keys 1, 2, 3, ..., 30 are inserted in increasing order. How many nodes does the final tree have?
- A. 13
- B. 12
- C. 16
- D. 14
Correct answer: D. 14
Sequential insertion always splits the rightmost full node, leaving the left halves with only 2 keys each (the minimum). The simulation gives 11 splits and a final tree of height 2 with 14 nodes in total (1 root, 3 internal nodes and 10 leaves).
Practise more Programming and Data Structures (GATE) questionsProgramming and Data Structures (GATE): notes and key points
More Programming and Data Structures (GATE) questions
- Items 1, 2, 3, 4, 5 arrive in this order and are inserted, each at either the front or the back of a double-ended queue (the choice is…
- A tree has 16 nodes numbered 0 to 15 with the parent array parent[1..15] = 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 9, 9, 10 (node i has parent…
- The same 16-node tree (parent array 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 9, 9, 10 for nodes 1 to 15, root 0) is to be cut by deleting edges…
- A binary tree is given in preorder with # for an empty child: 1 2 4 8 # # 9 # # 5 # 10 # # 3 6 # 11 # # 7 12 # # 13 # #. What is the…
- An undirected graph on vertices 0 to 7 has the edges 0-1, 0-2, 0-3, 1-2, 1-4, 2-3, 2-5, 3-4, 3-5, 4-5, 4-6, 5-6, 5-7, 6-7. Let A be its…
- An m × n sparse matrix with m = 1000 rows is stored in coordinate form (three arrays row, col, val, each of length nnz) or in compressed…