GATE Computer ScienceVery hardGATE CS (PYQ pattern)
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 one time slot and earns its profit only if finished by its deadline; one job per slot. What is the maximum total profit?
- A. 305
- B. 325
- C. 340
- D. 365
Correct answer: B. 325
Take jobs in decreasing profit and put each in the latest free slot at or before its deadline: 95 → slot 2, 85 → 3, 70 → 4, 60 → 1, then 55, 40, 30 find no free slot, and 15 takes slot 5: total 325. A brute force over all subsets also gives 325; 365 is the infeasible top-five sum.
More Algorithms questions
- 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…
- How many non-empty subsets of {3, 5, 6, 7, 9, 11, 13, 14} have an element sum divisible by 10?