您的位置:首页 > 理论基础

mit 计算机科学及编程导论(12)

2012-07-29 17:02 302 查看
words:

introspective , swallow your pride , latency , saw , symptom , haste , ramification , dust , raisin , tidy , revert , directory , anal , sermon , polemic , formulate , optimize , dual , constraint , bin , van , align , backpack , blanket , inventory ,
polynomial , burglar , grape , the periodic table , pour , dessert , thereof , discrete , stuff , trial , incarcerate , augment , dramatic

notes:

sth added to debug:

1. experienced programmer will have their own module to debug , they will list some bugs they usually made and guess them first.

2. keep record of what you've tried to be systematic

3. get help , try to explain to someone else or take a break

4.haste makes waste : don't fix when the thought first comes into your mind but to think will it fix all the symptoms (bug-free program)

5. make sure you can revert , save the old version

optimization problem : a function to maximize or minimize & a set of constraints

1. continuous knapsack problem : greedy algorithm --- always do the best choices

2. discrete problem : 0/1 knapsack problem . greedy algorithm doesn't work anymore , since local optimal decisions do not always lead to global optimal decisions. But greedy algorithm is fast and easy to capture . Brute force can get the right answer but
it's order of growth is exponential. So how we can optimize the brute force . We must first figure out themath formulation of the problem in order to compute. Then we usedecision tree to
analyze , and program . And we ascertain we can usememorization
to optimize .

ps:

the professor use optimization problem to show us how to formulate problem into math form and then use computer to compute . This is the main theme in this course.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: