由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 请教大家一个问题:book shelf problem(dynamic programming )
相关主题
find the subarray一道C++面试编程题
Dynamic buffer management question在 linux下有没有可能得到完全的fully static binary
[合集] 问个题--- web dynamic graphic generationstatic variable存在heap还是stack?
backend language of choicechar[] 和 char*有什么区别?
做一个基于网络的文档管理器help on php for dynamic dependent list box (转载)
再来问个蠢问题有用Agile的吗?
Please Help, dynamic memory after fork()shared_ptr and dynamic_pointer_cast
trouble using gdb debugging C/C++dynamic_cast operator in C++
相关话题的讨论汇总
话题: shelf话题: book话题: problem话题: height话题: dynamic
进入Programming版参与讨论
1 (共1页)
T******n
发帖数: 42
1
新人,问一道算法的作业。
Consider the problem of storing n books on shelves in a library. The
order of the books is fixed by the cataloging system and so cannot be
rearraged. Therefore, we can speak of a book bi, where 1 <= i <= n, that
has a thickness ti and height hi. The length of each bookshelf at this
library is L. Now consider the case where the height of the books is not
constant, but we have the freedom to adjust the height of each shelf to
that of the tallest book on the shelf. Thus the cost of a particular
layout is the sum of the heights of the largest book on each shelf.
(1) Give an example to show that the greedy algorithm of stuffing each
shelf as full as possible does not always give the minimum overall
height.
(2) What technique should we use to solve this problem?
(3) What are the subproblems?
(4) How many subproblems are there?
(5) Give an algorithm for this problem, and analyze its time complexity.
这个题是用dynamic programming做的。
1 (共1页)
进入Programming版参与讨论
相关主题
dynamic_cast operator in C++做一个基于网络的文档管理器
Dynamically generated FLASH再来问个蠢问题
vector< vector > > 怎么初始化?Please Help, dynamic memory after fork()
Visual C++ 如何高亮显示 括号匹配?trouble using gdb debugging C/C++
find the subarray一道C++面试编程题
Dynamic buffer management question在 linux下有没有可能得到完全的fully static binary
[合集] 问个题--- web dynamic graphic generationstatic variable存在heap还是stack?
backend language of choicechar[] 和 char*有什么区别?
相关话题的讨论汇总
话题: shelf话题: book话题: problem话题: height话题: dynamic