由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - Interview Question- Algorithm
相关主题
大家有没有把introduction to algorithms这本书看完阿zz If Carpenters Were Hired Like Programmers
请问小尾羊的那个CLRS的笔记谁有兴趣做道题?
请问 小肥羊 以前有个算法导论哪些要看哪些不要看的总结再请教个:C变长参数的传递问题
一个open question的讨论一道面试题
求解lintcode Wood Cut 问题G被锯,电/店面面经
问个careercup上面的题目求教一道关于string的Google面试题~~
epi 还是 The Algorithm Design ManualAlgorithm in C++大家怎么准备?
Leetcode上stack相关的题目相比CC150题怎么那么少?Longest Valid ParenthesesAlgorithms的书
相关话题的讨论汇总
话题: blocks话题: question话题: wood话题: interview话题: algorithm
进入JobHunting版参与讨论
1 (共1页)
d****n
发帖数: 233
1
This question can be asked in various forms, here is the one I was asked:
A carpenter is trying to build some furniture, he need a list wood blocks
with different length, say L1, L2, ... Ln where 1 <= Li <= LMAX for i = 1,2.
. n. He need to purchase whole wood blocks from the shop. The wood blocks
in the shop are fixed length, say LEN, LEN >= LMAX.
Can you help the carpenter save money by figuring out the minimum number of
whole wood blocks he need to purchase?
Any idea on how to solve this?
B*****t
发帖数: 335
2
这些都是背包问题变体

was asked:
wood blocks
for i = 1,2.
wood blocks
minimum number of

【在 d****n 的大作中提到】
: This question can be asked in various forms, here is the one I was asked:
: A carpenter is trying to build some furniture, he need a list wood blocks
: with different length, say L1, L2, ... Ln where 1 <= Li <= LMAX for i = 1,2.
: . n. He need to purchase whole wood blocks from the shop. The wood blocks
: in the shop are fixed length, say LEN, LEN >= LMAX.
: Can you help the carpenter save money by figuring out the minimum number of
: whole wood blocks he need to purchase?
: Any idea on how to solve this?

c*******L
发帖数: 125
3
bin packing
NP complete

2.
blocks
of

【在 d****n 的大作中提到】
: This question can be asked in various forms, here is the one I was asked:
: A carpenter is trying to build some furniture, he need a list wood blocks
: with different length, say L1, L2, ... Ln where 1 <= Li <= LMAX for i = 1,2.
: . n. He need to purchase whole wood blocks from the shop. The wood blocks
: in the shop are fixed length, say LEN, LEN >= LMAX.
: Can you help the carpenter save money by figuring out the minimum number of
: whole wood blocks he need to purchase?
: Any idea on how to solve this?

x******3
发帖数: 245
4
我觉得这道题不像背包问题,
如果是从一组不定长的木材中选出最少的来拼成给定长,那肯定是背包问题
d****n
发帖数: 233
5
xbeast23 is right, it asks how to use 最少的定长to cover all 不定长的木材.
Anybody has a link for solutions?
【 在 xbeast23 (xbeast23) 的大作中提到: 】
s*********s
发帖数: 318
6
DP?
Min(K) = Min (K1) + Min(K2), where K1+k2=K
Y*****y
发帖数: 361
7
This is exactly the classic bin packing problem. I guess the one we have
seen mostly is another variant of this problem.
See here http://en.wikipedia.org/wiki/Bin_packing_problem
B*****t
发帖数: 335
8
子集和,整数划分,装载等问题都是0-1背包问题的变形, 这些都是NPC的,一般情况下
没有
什么多项式的解法可以得到最优解。
lz给出的这类装载问题有很多近似解法,比较popular的是O(NlogN)的。如果要得到最优
解可以用回溯+二分,复杂度O(N^N*logN), 看着N^N比较可怕,不过加入剪枝后运算起来
还是比较快的。

【在 x******3 的大作中提到】
: 我觉得这道题不像背包问题,
: 如果是从一组不定长的木材中选出最少的来拼成给定长,那肯定是背包问题

x******3
发帖数: 245
9
能说下这道题用DP怎么解吗, 多谢啦

最优
起来

【在 B*****t 的大作中提到】
: 子集和,整数划分,装载等问题都是0-1背包问题的变形, 这些都是NPC的,一般情况下
: 没有
: 什么多项式的解法可以得到最优解。
: lz给出的这类装载问题有很多近似解法,比较popular的是O(NlogN)的。如果要得到最优
: 解可以用回溯+二分,复杂度O(N^N*logN), 看着N^N比较可怕,不过加入剪枝后运算起来
: 还是比较快的。

1 (共1页)
进入JobHunting版参与讨论
相关主题
Algorithms的书求解lintcode Wood Cut 问题
面试的时候可以用STL吗问个careercup上面的题目
A Video algorithm job from a headhunter (转载)epi 还是 The Algorithm Design Manual
紧急求救:calculate analogous figures forLeetcode上stack相关的题目相比CC150题怎么那么少?Longest Valid Parentheses
大家有没有把introduction to algorithms这本书看完阿zz If Carpenters Were Hired Like Programmers
请问小尾羊的那个CLRS的笔记谁有兴趣做道题?
请问 小肥羊 以前有个算法导论哪些要看哪些不要看的总结再请教个:C变长参数的传递问题
一个open question的讨论一道面试题
相关话题的讨论汇总
话题: blocks话题: question话题: wood话题: interview话题: algorithm