Data Structures & AlgorithmsVery hardGATE CS
A B-tree has minimum degree t = 4 (every non-root node has between 3 and 7 keys) and height 3 (a root-only tree has height 0). What are the minimum and maximum numbers of keys it can hold?
- A. 128 and 4095
- B. 127 and 3584
- C. 255 and 4095
- D. 127 and 4095
Correct answer: D. 127 and 4095
Minimum: root with 1 key and 2 children, then 4 children per node, each node holding 3 keys: 1 + 2(t − 1)(1 + t + … + t^2) = 2t^3 − 1 = 127. Maximum: every node full with 2t children: (2t)^4 − 1 = 4095.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- In how many different ways can 'abcdabcd' be split into a sequence of words from the dictionary {a, ab, abc, bcd, cd, d, abcd} (every…
- Six sorted files have 14, 31, 34, 35, 36, 58 records. Merging two files of sizes a and b costs a + b. What is the minimum total cost to…
- An undirected connected graph has edges A–D, A–G, B–E, C–E, C–G, D–H, D–I, F–I, G–H. How many articulation points (cut vertices) and how…
- Bellman–Ford runs from A on the directed graph whose edges are relaxed in EVERY pass in this fixed order: C→D (1), A→F (8), F→C (3), D→A…
- Edit distance between PARAGRAPH and BINARY where insert and delete cost 1 each but a substitution costs 2: what is the minimum total cost?
- Bellman–Ford runs from A on the directed graph whose edges are relaxed in EVERY pass in this fixed order: D→B (4), F→D (8), D→C (2), A→E…