您的位置:首页 > 其它

《算法导论》第一章-第1节_练习(参考答案)

2017-07-10 21:21 309 查看
算法导论(第三版)参考答案:练习1.1-1,练习1.1-2,练习1.1-3,练习1.1-4,练习1.1-5

Exercise 1.1-1

Give a real-world example that requires sorting or a real-world example that requires computing a convex hull.

排队问题:小学体育课上,老师要求我们由低到高站成一列。

防线修建:在经费有限的情况下,尽可能多的包含自己的城市。

Exercise 1.1-2

Other than speed, what other measures of efficiency might one use in a real-world setting?

资源利用率、内存占用情况。

Exercise 1.1-3

Select a data structure that you have seen previously, and discuss its strengths and limitations.

链表

优势:可变长度、不需要连续内存空间。

局限:查询某元素,需要遍历链表、需要多余的空间存放指针。

Exercise 1.1-4

How are the shortest-path and traveling-salesman problems given above similar? How are they different?

相似之处在于都是在寻找最短路径。

区别在于,最短路径问题是在给定两坐标后,寻找之间的实际路径长短最短的路线;而旅行商问题是需要遍历所有的地点后,最终回到起点的最短路线。

Exercise 1.1-5

Come up with a real-world problem in which only the best solution will do. Then come up with one in which a solution that is “approximately” the best is good enough.

如果你女朋友不喜欢香菜,那么在你俩的烛光晚餐中,必须不能有一点香菜。不然你的计划就泡汤了!

如果你的朋友不喜欢香菜,那么在一起出去聚餐时,碰巧点了一个上面撒了香菜的蛋羹。情况会好很多。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  算法导论