Redian新闻
>
PhD毕业后,需要多长时间的工作经验才能参加PE考试
avatar
PhD毕业后,需要多长时间的工作经验才能参加PE考试# Environmental - 环境科学与工程
n*r
1
给定一个array A, size(A) = n, n is an even number.
Denote Sum(A) = A[0]+A[1]+...+A[n-1]
Split A into A1, A2, size(A1) = size(A2) = n/2,
the goal is to minimize Sum(A1)-Sum(A2).
Is there any efficient algorithms for this problem?
avatar
c*n
2
请知道的大侠帮忙!
avatar
n*r
3
Sorry, the goal is to minimize
abs(Sum(A1)-Sum(A2))
avatar
v*n
4
One year in California.

【在 c********n 的大作中提到】
: 请知道的大侠帮忙!
avatar
T*9
5
没看懂啊
是Sum(A1)-Sum(A2)的绝对值么?要不你直接最大的n/2给A2,最小的n/2给A1

【在 n*******r 的大作中提到】
: 给定一个array A, size(A) = n, n is an even number.
: Denote Sum(A) = A[0]+A[1]+...+A[n-1]
: Split A into A1, A2, size(A1) = size(A2) = n/2,
: the goal is to minimize Sum(A1)-Sum(A2).
: Is there any efficient algorithms for this problem?

avatar
g*r
6
depends. go to your state license board to do research..

【在 c********n 的大作中提到】
: 请知道的大侠帮忙!
avatar
T*9
7
要是绝对值的话,应该是NPC
干脆recursive得了

【在 T*****9 的大作中提到】
: 没看懂啊
: 是Sum(A1)-Sum(A2)的绝对值么?要不你直接最大的n/2给A2,最小的n/2给A1

avatar
b*e
8
I believe this is NPC. Here is a reduction to Knapsack:
Given a Knapsack problem as follows:
An array A = {a1, ..., an}, where for each i, ai is a positive integer, find
a subset B of A such that sum(B) = v, where v is a positive interger.
Without
losing generality, we can assume v <= sum(A) / 2;
Let w = sum(A) - 2 * v.
Let A' = A union {w} union Z, where Z = {0, ..., 0} is a set that contains n
+1 0s.
Now if your problem can be solved effectively, then I apply that algorithm
on A' to find out

【在 n*******r 的大作中提到】
: 给定一个array A, size(A) = n, n is an even number.
: Denote Sum(A) = A[0]+A[1]+...+A[n-1]
: Split A into A1, A2, size(A1) = size(A2) = n/2,
: the goal is to minimize Sum(A1)-Sum(A2).
: Is there any efficient algorithms for this problem?

avatar
n*r
9
Thanks for proving this is a NPC, I will apply heuristic then.
avatar
s*h
10
blaze很牛啊。不过我没看懂
avatar
f*y
11
不止图灵
还有克雷千禧奖

find
n

【在 b***e 的大作中提到】
: I believe this is NPC. Here is a reduction to Knapsack:
: Given a Knapsack problem as follows:
: An array A = {a1, ..., an}, where for each i, ai is a positive integer, find
: a subset B of A such that sum(B) = v, where v is a positive interger.
: Without
: losing generality, we can assume v <= sum(A) / 2;
: Let w = sum(A) - 2 * v.
: Let A' = A union {w} union Z, where Z = {0, ..., 0} is a set that contains n
: +1 0s.
: Now if your problem can be solved effectively, then I apply that algorithm

avatar
d*a
12
why NPC? it's a sub/linear. just sort A first, and let A1=Q1(A),Q4(A) (first
and fourth quarters), and A2=Q2, Q3

【在 n*******r 的大作中提到】
: 给定一个array A, size(A) = n, n is an even number.
: Denote Sum(A) = A[0]+A[1]+...+A[n-1]
: Split A into A1, A2, size(A1) = size(A2) = n/2,
: the goal is to minimize Sum(A1)-Sum(A2).
: Is there any efficient algorithms for this problem?

avatar
b*e
13
1000, 999, 5, 4, 3, 2, 1, 0.
Even if you are not smart enough, try not to show your stupidity/ignorance.
I am trying to be nice, but I just can't help.

first

【在 d*****a 的大作中提到】
: why NPC? it's a sub/linear. just sort A first, and let A1=Q1(A),Q4(A) (first
: and fourth quarters), and A2=Q2, Q3

avatar
t*t
14
做人要厚道~~~

.

【在 b***e 的大作中提到】
: 1000, 999, 5, 4, 3, 2, 1, 0.
: Even if you are not smart enough, try not to show your stupidity/ignorance.
: I am trying to be nice, but I just can't help.
:
: first

avatar
n*t
15
所以说别和geek混啊,比他笨的多的人一样可以当你的老板,
你还得点头哈腰的。。。

.

【在 b***e 的大作中提到】
: 1000, 999, 5, 4, 3, 2, 1, 0.
: Even if you are not smart enough, try not to show your stupidity/ignorance.
: I am trying to be nice, but I just can't help.
:
: first

avatar
f*k
16
it's the famous subset sum problem, which is an NPC. search for Karmarkar/
Karp algorithm and its complete tree traversing version.

【在 n*******r 的大作中提到】
: Sorry, the goal is to minimize
: abs(Sum(A1)-Sum(A2))

avatar
d*a
17
我傻,你牛,承教,谢谢。

.

【在 b***e 的大作中提到】
: 1000, 999, 5, 4, 3, 2, 1, 0.
: Even if you are not smart enough, try not to show your stupidity/ignorance.
: I am trying to be nice, but I just can't help.
:
: first

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。