CS341 Study Guide - Minc, Optimal Substructure, Mercedes-Benz M180 Engine

57 views5 pages
21 Dec 2014
Course
Professor

Document Summary

Readings for today"s lecture: clrs 16. 1, 16. 2, 15. 1, 15. 2, 15. 3, 15. 4. More formally, here is the algorithm: x := min(w[i], free); sum := sum + v[i]*(x/w[i]); free := free - x; Suppose the optimal solution s is better than our greedy solution g. then s must agree for some number of items (perhaps 0) with g and then differ. To make life simpler, let"s assume that the ratios v[i]/w[i] are all distinct. Consider the first place where s differs from g, say when g chooses a certain amount of item k and s chooses a different amount. (here we are assuming the items have been ordered by decreasing order of value/weight. ) If s chooses more of item k, then choosing more would have been possible without exceeding w, so g would have done that too. Another paradigm on how to design an algorithm! Princeton university press, 1957; lc call number qa 264. b36) reference: chapter 15 of clrs.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents