1 / 6

Sum of subset reduce to Partition

Sum of subset reduce to Partition. 00366146 林季謙. Sum of Subset Problem. The Sum of Subset Problem ( 部份集合的和問題 ): 給予一組正整數的集合 S={a 1 , a 2 , … , a n } 及一個常數 c ,問 : 集合 S 中是否存在一組子集合 S’ ,此子集合 S’ 的數字總合為 c 。 Ex: 假設有一個集合 S = {12, 9, 33, 42, 7, 10, 5} 與常數 c = 24. 問 S’ = {9, 10, 5} 的總和會不會等於 c

saki
Télécharger la présentation

Sum of subset reduce to Partition

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sum of subset reduce to Partition 00366146 林季謙

  2. Sum of Subset Problem • The Sum of Subset Problem (部份集合的和問題): • 給予一組正整數的集合S={a1, a2, … , an}及一個常數c,問: 集合S中是否存在一組子集合S’,此子集合S’的數字總合為c。 • Ex: 假設有一個集合S = {12, 9, 33, 42, 7, 10, 5} 與常數c = 24. • 問S’ = {9, 10, 5}的總和會不會等於 c • 在此 C=24 所以 會回答Yes • If C=6 會回答No

  3. Partition Problem • 給予一組正整數的集合S={a1, a2, … , an},問: 是否可以將其分割成兩個子集合S1與S2,而此兩個子集合的個別總和相等。 • Ex: 設有一集合 S = {13, 2, 17, 20, 8}. • S1 = {13, 17} and S2 = {2, 20, 8}.

  4. Proof Sum of subset reduce to Partition • Sum of Subsets : A = { a1, a2, …, an }, M • Partition : B = { b1, b2, …,bn,bn+1,bn+2 }, and bi = ai, 1<i<n • 設bn+1=M+1 • bn+2=( )+1-M

  5. Consider a sum of subset problem S with {a1, a2, … , an} and B. • Let SUM(ai)=M for i= 1, 2, … , n. • We find an integer Q s.t. B+Q= ½(M+Q). (or Q=M-2B) • Let the corresponding partition problem instance P be {Q,a1,a2,…,an}. • We can partition P if and only if there is some subset of S that sums to B. • Ex. S={5, 7, 3, 8} and B=11. Set Q=M-2B=23-22=1. Then. P={1, 5, 7, 3, 8} has a partition {1, 3, 8}//{5, 7}.The former contains a subset with sum B=11.

  6. Sum of Subsets : A = { a1, a2, …, an }, MPartition : B = { b1, b2, …,bn,bn+1,bn+2 }, and bi = ai, 1<i<n設bn+1=M+1 bn+2=( )+1-M 假設有一個Sum of subset 的解 S 即 那麼 假設有一個partition的解,然而 需要不一樣且 ( )則存在S

More Related