Data Structures & AlgorithmsVery hardGATE CS
With 3 identical eggs and at most 5 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. 31
- B. 25
- C. 15
- D. 10
Correct answer: B. 25
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 = 25. 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
- A complete binary tree (array form, all levels full except possibly the last, which is filled from the left) has 187 nodes. How many…
- The directed graph A→C (4), A→E (5), B→A (6), C→B (8), D→C (1), E→B (9), E→C (-6), E→D (2) has one negative edge but no negative cycle…
- Prim's algorithm starts at F on the weighted undirected graph A–C (28), A–D (6), A–F (3), A–G (7), B–C (14), B–F (26), C–D (21), C–E (19)…
- How many topological orderings does the DAG on vertices A–F with edges C→F, D→A, D→F, E→A, F→A, F→B, F→E have?
- A tree on vertices 1–10 has edges 2–1, 3–1, 4–2, 5–2, 6–4, 7–6, 8–3, 9–7, 10–8. What is the size of a minimum DOMINATING set (every vertex…
- What is the length of the longest BITONIC subsequence (strictly increasing then strictly decreasing; either part may be empty) of [13, 15…