由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - partition array problem
相关主题
The time complexity on finding the kth largest element in aFacebook Phone Inteview + 流程请教
select k to maximize the minimum问个算法题2
问一道算法题怎么找均值相等的Two Partition of an array
请教一下subset I 输出子集顺序问题Another DP Problem: Balanced Partition
请问G一题说说某著名软件公司的onsite面试
MS a0, a1, ..., b0, b1... 问题stable rearrange an integer array with + and -
问个最近面试里的题目discuss an array rearrange question
Given an array of N integers from range [0, N] and one is missing. Find the missing number.请教一个DP的问题
相关话题的讨论汇总
话题: a2话题: array话题: a1话题: partition话题: sum
进入JobHunting版参与讨论
1 (共1页)
s******e
发帖数: 108
1
give array of 2*n integers A,
partition it into two array of n element(A1,A2),
make their sum closest to each other(min | sum A1 - sum A2 | )
w****x
发帖数: 2483
2
一种方法是看所有的n subset.
一种方法是先随便分成两个n的sub array, 然后再while循环里试图交换两个element以
使得| sum A1 - sum A2 | 小余当前最优解, 终止条件是找不到这样的swap
t*****l
发帖数: 241
3
np hard problem.

【在 s******e 的大作中提到】
: give array of 2*n integers A,
: partition it into two array of n element(A1,A2),
: make their sum closest to each other(min | sum A1 - sum A2 | )

f*****e
发帖数: 2992
4
http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi?board=ri

【在 s******e 的大作中提到】
: give array of 2*n integers A,
: partition it into two array of n element(A1,A2),
: make their sum closest to each other(min | sum A1 - sum A2 | )

f*****e
发帖数: 2992
5
刚才推了一下,转化为最大割问题,我们知道最大流最小割是P,最大割只有MIT Goema
ns的随机近似算法,这个问题比Goemans的多两个条件。

【在 f*****e 的大作中提到】
: http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi?board=ri
t******t
发帖数: 21
6
how about greedy?
sort the array say {1,2,3, 80, 85, 99, 100, 1000}
pick 1000 first in A1
pick 100 in A2
if (sum1 -sum2)900 > next max 99
pick next min 1 in A1 and next max 99 in A2
else if sum1 > sum2 pick next max in A2, then repeat recursively

【在 s******e 的大作中提到】
: give array of 2*n integers A,
: partition it into two array of n element(A1,A2),
: make their sum closest to each other(min | sum A1 - sum A2 | )

1 (共1页)
进入JobHunting版参与讨论
相关主题
请教一个DP的问题请问G一题
One Microsoft interview questionMS a0, a1, ..., b0, b1... 问题
问个google面试题问个最近面试里的题目
Facebook 电面Given an array of N integers from range [0, N] and one is missing. Find the missing number.
The time complexity on finding the kth largest element in aFacebook Phone Inteview + 流程请教
select k to maximize the minimum问个算法题2
问一道算法题怎么找均值相等的Two Partition of an array
请教一下subset I 输出子集顺序问题Another DP Problem: Balanced Partition
相关话题的讨论汇总
话题: a2话题: array话题: a1话题: partition话题: sum