GATE Computer ScienceVery hardGATE CS (PYQ pattern)
Intervals (start, end, weight) are (0,3,4), (1,5,6), (2,6,10), (5,8,7), (4,9,9), (7,10,3), (9,12,8), (8,13,5), (12,15,6), (10,16,12); two intervals are compatible when one ends no later than the other starts. The maximum total weight of a set of pairwise compatible intervals is:
- A. 25
- B. 26
- C. 31
- D. 27
Correct answer: D. 27
Weighted interval scheduling DP over intervals sorted by end time gives 27 (confirmed by brute force over all 1024 subsets). Both the earliest-finish greedy and the heaviest-first greedy yield only 25, and 31 is the unattainable sum of the three heaviest overlapping intervals.
More Algorithms questions
- Ten unit-time jobs have (deadline, profit): (2,95), (1,60), (2,40), (3,85), (3,30), (1,25), (4,70), (2,20), (4,55), (5,15). Each job takes…
- Seven keys have search probabilities (in percent, in sorted key order) 18, 6, 22, 14, 4, 20, 16 and only successful searches occur. The…
- The egg-drop puzzle: a building has 100 floors, and you have 3 identical eggs. An egg that is dropped from a floor at or above the…
- A building has 100 floors and you have 2 identical eggs; an egg breaks when dropped from the critical floor or above, and a broken egg…
- Floyd–Warshall is run on a 5-vertex directed graph with weight matrix (rows are sources, ∞ = no edge): row1: [0, 6, ∞, 3, ∞]; row2: [∞, 0…
- Six jobs have (processing time, weight): (4,3), (2,5), (7,2), (3,6), (5,4), (1,1). A single machine runs them one at a time without gaps…