Data Structures & AlgorithmsVery hardGATE CS · Advanced
Keys 10, 20, 30, 40, 50, 60, 70, 80, 15, 25, 35, 45 are inserted in this order into an empty B-tree of minimum degree t = 2 (every node holds 1 to 3 keys), using the proactive method: while descending, every full node (3 keys) met on the way is split first, and a full root is split before inserting. How many node splits happen in total?
- A. 2
- B. 3
- C. 4
- D. 5
Correct answer: C. 4
Simulate the descent: each time a full node (3 keys) is met on the way down it is split before moving on, and a full root adds a level. Counting every such split over the 12 insertions gives 4.
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 words car, card, care, cart, cat, dog, dot, dove, do, door are stored in a trie (one letter per edge, with a flag marking the end of a…
- A disjoint-set forest on elements 1..10 starts with every element as its own root. Union(a, b) finds both roots (find uses full path…
- A tree on the vertices A–J has the edges A–B, B–C, C–D, A–E, D–F, B–G, F–H, A–I, C–J. What is the sum of the distances over all unordered…
- A directed acyclic graph has the vertices A–G and the arcs D→F, D→C, D→B, G→C, G→A, C→A, C→E, C→B. How many different topological…
- In a bipartite graph the left vertices are L1–L6 and the right vertices are R1–R6, with the edges L1–R3, L1–R5, L1–R6, L2–R3, L3–R2…
- Dijkstra's algorithm (a vertex is settled when removed from the priority queue and its distance is never changed afterwards) is run from A…