Two problems about Algorithm# JobHunting - 待字闺中
r*e
1 楼
1 In a dance class, n male students and n female students should be paired
so as to minimize the sum of the height differences of the n pairs. Design a
greedy algorithm and a DP algorithm to solve it.
第一题应该是差的绝对值之和吧
2 There are n white dots and n black dots, equally spaced, in a line. You
want to connect each white dot with some one black dot, with a minimum total
length of 'wire'. Design a greedy algorithm and a DP algorithm to solve it.
It is better to have a proof if you use a greedy algorithm.
这两道题目的愿意是,给出greedy的方法,并且证明合理,如果不合理就举出反例。然
后给出DP的方法。
so as to minimize the sum of the height differences of the n pairs. Design a
greedy algorithm and a DP algorithm to solve it.
第一题应该是差的绝对值之和吧
2 There are n white dots and n black dots, equally spaced, in a line. You
want to connect each white dot with some one black dot, with a minimum total
length of 'wire'. Design a greedy algorithm and a DP algorithm to solve it.
It is better to have a proof if you use a greedy algorithm.
这两道题目的愿意是,给出greedy的方法,并且证明合理,如果不合理就举出反例。然
后给出DP的方法。