Data Structures & AlgorithmsVery hardProduct-company placement
With 3 identical eggs and at most 7 drops, what is the largest number of floors for which you can always determine the critical floor (the lowest floor from which an egg breaks, possibly none)?
- A. 63
- B. 127
- C. 21
- D. 35
Correct answer: A. 63
f(t, e) = f(t−1, e−1) + 1 + f(t−1, e): one drop splits floors into those below (egg broke) and above (egg survived). The closed form is Σ C(t, i) for i = 1..3 = 63. 2^t − 1 would need unlimited eggs.
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
- 0/1 knapsack with capacity 18: items (weight, value) = (8, 39), (2, 16), (3, 24), (6, 38), (3, 36). What is the maximum total value?
- Six sorted files have 8, 23, 33, 38, 42, 49 records. Merging two files of sizes a and b costs a + b. What is the minimum total cost to…
- Kruskal's algorithm runs on the weighted undirected graph A–B (15), A–F (7), A–G (21), B–C (17), B–D (23), B–F (22), D–F (8), E–F (13)…
- A complete binary tree (array form, all levels full except possibly the last, which is filled from the left) has 131 nodes. How many…
- Six sorted files have 10, 12, 13, 21, 23, 42 records. Merging two files of sizes a and b costs a + b. What is the minimum total cost to…
- Five matrices have dimensions 3×2 , 2×4 , 4×2 , 2×8 , 8×10. What is the minimum number of scalar multiplications needed to compute their…