Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

Jobs as (processing time, weight) are [(3, 2), (2, 1), (4, 4), (1, 3)]. They run one at a time with no idle time, and the cost is the sum of weight × completion time. What is the minimum possible total cost?

  1. A. 58
  2. B. 49
  3. C. 53
  4. D. 27

Correct answer: B. 49

Smith's rule: order jobs by processing time divided by weight, smallest ratio first (an exchange argument shows adjacent swaps help exactly then). Sorting by processing time alone (SPT) ignores the weights.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic