Data Structures & AlgorithmsVery hardGATE CS · Product-company placement
A B-tree has minimum degree t = 4 (every non-root node has between 3 and 7 keys) and height 2 (a root-only tree has height 0). What are the minimum and maximum numbers of keys it can hold?
- A. 32 and 511
- B. 31 and 448
- C. 31 and 511
- D. 63 and 511
Correct answer: C. 31 and 511
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^1) = 2t^2 − 1 = 31. Maximum: every node full with 2t children: (2t)^3 − 1 = 511.
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
- The weighted undirected graph A–B (6), A–D (16), A–E (19), A–F (12), B–E (1), B–F (2), C–D (26), C–E (14) has a unique MST. What is the…
- Kruskal's algorithm runs on the weighted undirected graph A–B (20), A–C (3), A–E (8), A–F (6), B–D (10), C–D (1), C–G (16), D–E (25), D–F…
- A binary search tree holds exactly the keys 16, 17, 41, 44, 69, 81, 82, 95. Which ONE of the following sequences can be its PREORDER…
- In the DAG with edges A→D, A→F, C→B, D→B, D→C, D→E, D→F, D→G, E→B, G→E, G→F, how many distinct directed paths are there from A to F, and…
- An undirected graph has edges A–B, A–G, B–E, C–E, C–F, C–G, D–E, D–F, D–G. An ITERATIVE DFS starts with stack [A]; it pops a vertex, skips…
- What is the length of the shortest string that has BOTH COMPUTER and SUBSEQUENT as subsequences (shortest common supersequence)?