Data Structures & AlgorithmsVery hardGATE CS
A B-tree has minimum degree t = 3 (every non-root node has between 2 and 5 keys) and height 3 (a root-only tree has height 0). What are the minimum and maximum numbers of keys it can hold?
- A. 54 and 1295
- B. 53 and 1295
- C. 53 and 1080
- D. 80 and 1295
Correct answer: B. 53 and 1295
Minimum: root with 1 key and 2 children, then 3 children per node, each node holding 2 keys: 1 + 2(t − 1)(1 + t + … + t^2) = 2t^3 − 1 = 53. Maximum: every node full with 2t children: (2t)^4 − 1 = 1295.
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
- How many subsets of {1, 4, 8, 9, 10, 11, 12} have sum exactly 27?
- What is the maximum flow from S to T in the network with directed capacities A→B (15), A→C (9), A→T (12), B→T (12), C→B (12), S→A (6), S→B…
- An undirected graph has edges A–B, A–D, B–H, C–D, C–F, C–G, D–G, E–F, E–H, F–G. BFS starts at A and always scans neighbours in…
- A binary tree with distinct labels has INORDER G D C I F A B H E and LEVEL-ORDER E A D H G I B C F. What is its postorder traversal?
- An undirected graph has edges A–D, B–D, B–F, C–D, C–E, D–G, E–F, E–H, F–G, G–H. BFS starts at A and always scans neighbours in…
- An undirected graph has edges A–C, A–E, B–D, B–E, C–D, C–F, D–G, E–F, E–G. An ITERATIVE DFS starts with stack [A]; it pops a vertex, skips…