SLIDE 1
Equal-Subset-Sum faster than the Meet-in-the-Middle
Marcin Mucha, Jesper Nederlof, Jakub Pawlewicz, Karol Węgrzycki
University of Warsaw, TU/e
ESA 2019
SLIDE 2 Definitions
Subset Sum: Given set S of integers, and integer t. Find A ⊆ S, such that Σ(A) = t. Example: S = {2, 4, 9, 10, 16, 19}, t = 27, answer YES
Here, Σ(A) =
ai∈A ai.
SLIDE 3 Definitions
Subset Sum: Given set S of integers, and integer t. Find A ⊆ S, such that Σ(A) = t. Example: S = {2, 4, 9, 10, 16, 19}, t = 27, answer YES Equal-Subset-Sum: Given set S of integers. Find A, B ⊆ S, nonempty, different such that Σ(A) = Σ(B). Example: S = {2, 4, 9, 10, 16, 19}, answer YES
Here, Σ(A) =
ai∈A ai.
SLIDE 4 Definitions
Subset Sum: Given set S of integers, and integer t. Find A ⊆ S, such that Σ(A) = t. Example: S = {2, 4, 9, 10, 16, 19}, t = 27, answer YES Equal-Subset-Sum: Given set S of integers. Find A, B ⊆ S, nonempty, different such that Σ(A) = Σ(B). Example: S = {2, 4, 9, 10, 16, 19}, answer YES Lower Bounds: No 2o(n) for Equal-Subset-Sum or Subset Sum if Exponential Time Hypothesis.
[Woeginger and Yu]
The best we can hope for is O∗ (cn). In this talk we break natural barrier for c.
Here, Σ(A) =
ai∈A ai.
SLIDE 5 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
SLIDE 6 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 7 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 8 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 9 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 10 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 11 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 12 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 13 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 14 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 15 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S, t = 100 81 80 43 40 30 26 17 11 9 15 ↑ YES: Σ(A) = t
Algorithm: [Folklore] For every number a ∈ S, decide if a is in the solution A. Check if Σ(A) = t. Running time: There are n bits to guess. Hence running time is O∗ (2n).
SLIDE 16 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
SLIDE 17 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 18 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 19 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 20 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 21 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 22 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 23 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 24 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 25 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 26 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in time O∗ 2n/2 Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 2n/2
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S 81 80 43 40 30 26 17 11 9 15 ↑ YES: Σ(A) = Σ(B)
Algorithm: [Folklore] For every number a ∈ S, decide if a is in A, B or S \ (A ∪ B). Check if Σ(A) = Σ(B). Running time: There are n guesses. Each guess has 3
- choices. Hence running time is O∗ (3n).
SLIDE 27 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 3n/2 .
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} Algorithm: [Horowitz and Sahni 1974]
- 1. Arbitrarily partition S = S1 ∪ S2.
SLIDE 28 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 3n/2 .
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} Σ(S′
1)
. . . L = 2S1 Algorithm: [Horowitz and Sahni 1974]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. Enumerate L = 2S1,
|L| = 2n/2
SLIDE 29 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 3n/2 .
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} . . . L = 2S1 Note that |L| = O∗ 2n/2 (Guess if a ∈ S1 in A or not) Algorithm: [Horowitz and Sahni 1974]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. Enumerate L = 2S1,
|L| = 2n/2
SLIDE 30 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 3n/2 .
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} . . . L = 2S1 . . . R = 2S2 Algorithm: [Horowitz and Sahni 1974]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. Enumerate L = 2S1,
|L| = 2n/2
|R| = 2n/2
SLIDE 31 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 3n/2 .
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} . . . L = 2S1 . . . R = 2S2 Algorithm: [Horowitz and Sahni 1974]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. Enumerate L = 2S1,
|L| = 2n/2
|R| = 2n/2
O∗(|R| log |R|)
SLIDE 32 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in time O∗ 3n/2 .
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} . . . L = 2S1 . . . R = 2S2 a t − a Algorithm: [Horowitz and Sahni 1974]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. Enumerate L = 2S1,
|L| = 2n/2
|R| = 2n/2
O∗(|R| log |R|)
do binary search ◮ check if (t − a) ∈ R
◮ if yes, return true
SLIDE 33 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
SLIDE 34 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} Algorithm: [Woeginger 2004]
- 1. Arbitrarily partition S = S1 ∪ S2.
SLIDE 35 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} Σ(A) − Σ(B) . . . L Algorithm: [Woeginger 2004]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. L = {Σ(A) − Σ(B) | A ⊆ S1, B ⊆ S1 \ A},
SLIDE 36 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} Note that |L| = O∗ 3n/2 (Guess if a ∈ S1 in A or B
Σ(A) − Σ(B) . . . L Algorithm: [Woeginger 2004]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. L = {Σ(A) − Σ(B) | A ⊆ S1, B ⊆ S1 \ A},
SLIDE 37 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} Σ(A) − Σ(B) . . . L . . . R Algorithm: [Woeginger 2004]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. L = {Σ(A) − Σ(B) | A ⊆ S1, B ⊆ S1 \ A},
- 3. R = {Σ(A) − Σ(B) | A ⊆ S2, B ⊆ S2 \ A}
SLIDE 38 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} Σ(A) − Σ(B) . . . L . . . R Algorithm: [Woeginger 2004]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. L = {Σ(A) − Σ(B) | A ⊆ S1, B ⊆ S1 \ A},
- 3. R = {Σ(A) − Σ(B) | A ⊆ S2, B ⊆ S2 \ A}
SLIDE 39 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} Σ(A) − Σ(B) . . . L . . . R x −x Algorithm: [Woeginger 2004]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. L = {Σ(A) − Σ(B) | A ⊆ S1, B ⊆ S1 \ A},
- 3. R = {Σ(A) − Σ(B) | A ⊆ S2, B ⊆ S2 \ A}
- 4. Find x ∈ L and y ∈ R, s.t., x + y = 0
SLIDE 40 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
S1 = {a1, . . . , an/2} S2 = {an/2+1, . . . , an} Σ(A) − Σ(B) . . . L . . . R x −x Algorithm: [Woeginger 2004]
- 1. Arbitrarily partition S = S1 ∪ S2.
- 2. L = {Σ(A) − Σ(B) | A ⊆ S1, B ⊆ S1 \ A},
- 3. R = {Σ(A) − Σ(B) | A ⊆ S2, B ⊆ S2 \ A}
- 4. Find x ∈ L and y ∈ R, s.t., x + y = 0
Analysis: If Σ(A1) − Σ(B1) = −Σ(A2) + Σ(B2), then Σ(A1 ∪ A2) = Σ(B1 ∪ B2). Running time: |L| = |R| = O∗(3n/2)
SLIDE 41 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
SLIDE 42 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
Big Open Problem: Can we improve meet-in-the-middle for Subset Sum? Main Result: We can improve meet in the middle for Equal-Subset-Sum!
SLIDE 43 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
Big Open Problem: Can we improve meet-in-the-middle for Subset Sum? Main Result: We can improve meet in the middle for Equal-Subset-Sum! Previous running time: O∗ (1.7321n) Meet-in-the-Middle
deterministic
New running time: O∗ (1.7088n) This talk
randomized
SLIDE 44 Naive: Subset-Sum in O∗ (2n) time Meet-in-the-Middle: Subset-Sum in O∗ 2n/2 time Naive: Equal-Subset-Sum in O∗ (3n) time. Meet-in-the-Middle: Equal-Subset-Sum in O∗ 3n/2 time.
Subset Sum: Given S, t. Find S′ ⊆ S, that Σ(S) = t. Equal-Subset-Sum: Given
- S. Find nonempty, different
A, B ⊆ S, such that Σ(A) = Σ(B).
Big Open Problem: Can we improve meet-in-the-middle for Subset Sum? Main Result: We can improve meet in the middle for Equal-Subset-Sum! Previous running time: O∗ (1.7321n) Meet-in-the-Middle
deterministic
New running time: O∗ (1.7088n) This talk
randomized
Rest of the talk: O∗ (1.7088n) algorithm for Equal-Subset-Sum.
SLIDE 45
New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
SLIDE 46 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2 ℓ/2
SLIDE 47 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2 ℓ/2
S = {a1, . . . , an} Given set |S| = n
SLIDE 48 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2 ℓ/2
S1 S2 Randomly partition S into |S1| = |S2| = n/2
SLIDE 49 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2 ℓ/2
S1 S2 A1 ∪ B1 Enumarate A1 ∪ B1 from S1 in n/2
ℓ/2
SLIDE 50 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2 ℓ/2
S1 S2 A1 B1 Enumarate partitions of A1 ∪ B1 into A1 and B1 in 2ℓ/2.
SLIDE 51 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2 ℓ/2
S1 S2 A1 B1 A2 B2 Do the same for A2 and B2 in n/2
ℓ/2
SLIDE 52 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2 ℓ/2
S1 S2 A1 B1 A2 B2 Use meet-in-the-middle: Σ(A1) − Σ(B1) = Σ(B2) − Σ(A2).
SLIDE 53 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2 ℓ/2
S1 S2 A1 B1 A2 B2 Analysis: If S1 and S2 are random then |S1 ∩ (A ∪ B)| = ℓ/2 (whp.)
SLIDE 54 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2
ℓ/2
.
SLIDE 55 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2
ℓ/2
. If ℓ
n = 2 3, then O∗ n/2 n/3
= O∗ 3n/2 .
1.73 0.66 Parameter l/n Exponent of the running time
SLIDE 56 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2
ℓ/2
. If ℓ
n = 2 3, then O∗ n/2 n/3
= O∗ 3n/2 . Observe that for ℓ
n /
∈ ( 2
3 − ε, 2 3 + ε), running
time is O∗ (3 − ε′)n/2 !
1.73 0.66 Parameter l/n Exponent of the running time
SLIDE 57 New algorithm for Equal-Subset-Sum: Simple observation
Minimum Solution: A, B ⊆ S is minimum solution for Equal-Subset-Sum, if Σ(A) = Σ(B) and its size |A| + |B| > 0 is as low as possible.
(A and B are disjoint)
Corollary (from meet-in-the-middle) If S has minimum solution of size ℓ, then Equal-Subset-Sum can be solved in time: O∗ n/2
ℓ/2
. If ℓ
n = 2 3, then O∗ n/2 n/3
= O∗ 3n/2 . Observe that for ℓ
n /
∈ ( 2
3 − ε, 2 3 + ε), running
time is O∗ (3 − ε′)n/2 !
1.73 0.66 Parameter l/n Exponent of the running time
The hardest case is ℓ ≈ 2n
3
SLIDE 58
New algorithm for Equal-Subset-Sum: hard case
Goal: We want to detect minimum solution A, B ⊆ S with |A ∪ B| ≈ 2n
3 .
What combinatorial property can we use then?
SLIDE 59
New algorithm for Equal-Subset-Sum: hard case
Goal: We want to detect minimum solution A, B ⊆ S with |A ∪ B| ≈ 2n
3 .
What combinatorial property can we use then? Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. A B X S Proof: If a pair (A, B) is a solution, then Σ(A ∪ X) = Σ(B ∪ X). Moreover there are 2n/3 different choices of X and by minimality all X are different.
SLIDE 60
How to use combinatorial lemma?
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Idea: Hash all 2n subsets of S into p = 2n/3 buckets
SLIDE 61
How to use combinatorial lemma?
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Idea: Hash all 2n subsets of S into p = 2n/3 buckets . . . . . . C1 C2 C3 C4 C5 C6 Cp
SLIDE 62
How to use combinatorial lemma?
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Idea: Hash all 2n subsets of S into p = 2n/3 buckets . . . . . . C1 C2 C3 C4 C5 C6 Cp
SLIDE 63
How to use combinatorial lemma?
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Idea: Hash all 2n subsets of S into p = 2n/3 buckets . . . . . . C1 C2 C3 C4 C5 C6 Cp Hash function: Ct = {X ⊆ S | Σ(X) ≡p t}
SLIDE 64
How to use combinatorial lemma?
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Idea: Hash all 2n subsets of S into p = 2n/3 buckets . . . . . . C1 C2 C3 C4 C5 C6 Cp p
2n p
Hash function: Ct = {X ⊆ S | Σ(X) ≡p t} Properties: ◮ E [Ct] = 2n
p = 22n/3
SLIDE 65
How to use combinatorial lemma?
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Idea: Hash all 2n subsets of S into p = 2n/3 buckets . . . . . . C1 C2 C3 C4 C5 C6 Cp p
2n p
Hash function: Ct = {X ⊆ S | Σ(X) ≡p t} Properties: ◮ E [Ct] = 2n
p = 22n/3
◮ Each Ct contains pair Σ(A) = Σ(B) (whp)
SLIDE 66
How to use combinatorial lemma?
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Idea: Hash all 2n subsets of S into p = 2n/3 buckets . . . . . . C1 C2 C3 C4 C5 C6 Cp p
2n p
Hash function: Ct = {X ⊆ S | Σ(X) ≡p t} Properties: ◮ E [Ct] = 2n
p = 22n/3
◮ Each Ct contains pair Σ(A) = Σ(B) (whp) We can restrict attention to find a duplicate in a single bucket.
SLIDE 67
New algorithm for Equal-Subset-Sum: when |A ∪ B| ≈ 2n
3
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s.
SLIDE 68 New algorithm for Equal-Subset-Sum: when |A ∪ B| ≈ 2n
3
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Algorithm:
- 1. Pick a random prime p of order 2n/3 and a random t ∈ {1, . . . 2n/3}
Properties:
SLIDE 69 New algorithm for Equal-Subset-Sum: when |A ∪ B| ≈ 2n
3
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Algorithm:
- 1. Pick a random prime p of order 2n/3 and a random t ∈ {1, . . . 2n/3}
- 2. Let C = {X ⊆ S | Σ(X) ≡p t}
Hash and choose a random bucket
Properties:
- 1. C contains X, Y , such that Σ(X) = Σ(Y ) (whp.)
SLIDE 70 New algorithm for Equal-Subset-Sum: when |A ∪ B| ≈ 2n
3
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Algorithm:
- 1. Pick a random prime p of order 2n/3 and a random t ∈ {1, . . . 2n/3}
- 2. Let C = {X ⊆ S | Σ(X) ≡p t}
Hash and choose a random bucket
In time O∗ |C| + 2n/2 with meet-in-the-middle
Properties:
- 1. C contains X, Y , such that Σ(X) = Σ(Y ) (whp.)
- 2. E [|C|] = O∗
22n/3
SLIDE 71 New algorithm for Equal-Subset-Sum: when |A ∪ B| ≈ 2n
3
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Algorithm:
- 1. Pick a random prime p of order 2n/3 and a random t ∈ {1, . . . 2n/3}
- 2. Let C = {X ⊆ S | Σ(X) ≡p t}
Hash and choose a random bucket
In time O∗ |C| + 2n/2 with meet-in-the-middle
- 4. Find X, Y ∈ C, such that Σ(X) = Σ(Y ).
Sorting
Properties:
- 1. C contains X, Y , such that Σ(X) = Σ(Y ) (whp.)
- 2. E [|C|] = O∗
22n/3
- 3. We can find X, Y ∈ C in O∗ (|C| log |C|) time by sorting.
SLIDE 72 New algorithm for Equal-Subset-Sum: when |A ∪ B| ≈ 2n
3
Combinatorial Lemma: If A, B ⊆ S is a minimum solution of size 2n
3 , then there are
at least 2n/3 different s and nontrivial As, Bs ⊆ S with Σ(As) = Σ(Bs) = s. Algorithm:
- 1. Pick a random prime p of order 2n/3 and a random t ∈ {1, . . . 2n/3}
- 2. Let C = {X ⊆ S | Σ(X) ≡p t}
Hash and choose a random bucket
In time O∗ |C| + 2n/2 with meet-in-the-middle
- 4. Find X, Y ∈ C, such that Σ(X) = Σ(Y ).
Sorting
Properties:
- 1. C contains X, Y , such that Σ(X) = Σ(Y ) (whp.)
- 2. E [|C|] = O∗
22n/3
- 3. We can find X, Y ∈ C in O∗ (|C| log |C|) time by sorting.
Running time: O∗ (|C| log |C|) = O∗ 22n/3 ≪ O∗ 3n/2 for the hardest case!
SLIDE 73
New algorithm for Equal-Subset-Sum: Generalization
We saw: if ℓ = 2n
3 , then algorithm runs in O∗
22n/3 time. Will it generalize to O∗ 2ℓ ?
SLIDE 74
New algorithm for Equal-Subset-Sum: Generalization
We saw: if ℓ = 2n
3 , then algorithm runs in O∗
22n/3 time. Will it generalize to O∗ 2ℓ ? YES with a small technical detail. . . .
SLIDE 75
New algorithm for Equal-Subset-Sum: Generalization
We saw: if ℓ = 2n
3 , then algorithm runs in O∗
22n/3 time. Will it generalize to O∗ 2ℓ ? YES with a small technical detail. . . . Combinatorial lemma for general ℓ: If A, B ⊆ S is a minimum solution of size ℓ and ℓ > n
2 , then there are at least 2n−ℓ different s and nontrivial As, Bs ⊆ S with
Σ(As) = Σ(Bs) = s.
SLIDE 76
New algorithm for Equal-Subset-Sum: Generalization
We saw: if ℓ = 2n
3 , then algorithm runs in O∗
22n/3 time. Will it generalize to O∗ 2ℓ ? YES with a small technical detail. . . . Combinatorial lemma for general ℓ: If A, B ⊆ S is a minimum solution of size ℓ and ℓ > n
2 , then there are at least 2n−ℓ different s and nontrivial As, Bs ⊆ S with
Σ(As) = Σ(Bs) = s. A B X1 X2 S When ℓ < n
2 there may be some X1, X2 that Σ(X1) = Σ(X2)!
SLIDE 77
New algorithm for Equal-Subset-Sum: Generalization
We saw: if ℓ = 2n
3 , then algorithm runs in O∗
22n/3 time. Will it generalize to O∗ 2ℓ ? YES with a small technical detail. . . . Combinatorial lemma for general ℓ: If A, B ⊆ S is a minimum solution of size ℓ and ℓ > n
2 , then there are at least 2n−ℓ different s and nontrivial As, Bs ⊆ S with
Σ(As) = Σ(Bs) = s. A B X1 X2 S When ℓ < n
2 there may be some X1, X2 that Σ(X1) = Σ(X2)!
Algorithm for general ℓ: choose p, t ≈ 2n−ℓ. Then E [|Ct,p|] ≈ 2ℓ and algorithm runs in time O∗ 2ℓ when ℓ > n
2 .
SLIDE 78 New algorihm for Equal-Subset-Sum: Tradeoff
Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2
ℓ/2
SLIDE 79 New algorihm for Equal-Subset-Sum: Tradeoff
Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2
ℓ/2
1.7321
SLIDE 80 New algorihm for Equal-Subset-Sum: Tradeoff
Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2
ℓ/2
Algorithm 2 (Previous slides): Running time O∗ 2ℓ (only if ℓ > n
2 ) 1.7321
SLIDE 81 New algorihm for Equal-Subset-Sum: Tradeoff
Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2
ℓ/2
Algorithm 2 (Previous slides): Running time O∗ 2ℓ (only if ℓ > n
2 )
Tradeoff: Guess ℓ (polynomial overhead) and run the faster algorithm.
1.7321 1.7088
SLIDE 82 New algorihm for Equal-Subset-Sum: Tradeoff
Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2
ℓ/2
Algorithm 2 (Previous slides): Running time O∗ 2ℓ (only if ℓ > n
2 )
Tradeoff: Guess ℓ (polynomial overhead) and run the faster algorithm.
1.7321 1.7088
O∗
ℓ
n/2 ℓ/2
SLIDE 83 New algorihm for Equal-Subset-Sum: Tradeoff
Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2
ℓ/2
Algorithm 2 (Previous slides): Running time O∗ 2ℓ (only if ℓ > n
2 )
Tradeoff: Guess ℓ (polynomial overhead) and run the faster algorithm.
1.7321 1.7088
O∗
ℓ
n/2 ℓ/2
ℓ
n 2 (h(α)+α),2αn
Notation: ℓ = αn and h(α) = −α log2 α − (1 − α) log2 1 − α.
SLIDE 84 New algorihm for Equal-Subset-Sum: Tradeoff
Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2
ℓ/2
Algorithm 2 (Previous slides): Running time O∗ 2ℓ (only if ℓ > n
2 )
Tradeoff: Guess ℓ (polynomial overhead) and run the faster algorithm.
1.7321 1.7088
O∗
ℓ
n/2 ℓ/2
ℓ
n 2 (h(α)+α),2αn
By numeric calculations α ≈ 0.773, when h(α) = α and 2αn ≈ 1.7088n.
Notation: ℓ = αn and h(α) = −α log2 α − (1 − α) log2 1 − α.
SLIDE 85
New algorithm for Equal-Subset-Sum: Our results
Main theorem Equal-Subset-Sum can be solved in O∗ (1.7088n) time (meet-in-the-middle gives O∗ 3n/2 ≤ O∗ (1.7321n).
SLIDE 86
New algorithm for Equal-Subset-Sum: Our results
Main theorem Equal-Subset-Sum can be solved in O∗ (1.7088n) time (meet-in-the-middle gives O∗ 3n/2 ≤ O∗ (1.7321n). This also extends to the exact algorithm for Number Balancing, i.e., given a set S of n numbers and the task is to find two disjoint, nonempty subsets A, B ⊆ S, such that |Σ(A) − Σ(B)| is minimized (details in the paper).
SLIDE 87
New algorithm for Equal-Subset-Sum: Our results
Main theorem Equal-Subset-Sum can be solved in O∗ (1.7088n) time (meet-in-the-middle gives O∗ 3n/2 ≤ O∗ (1.7321n). This also extends to the exact algorithm for Number Balancing, i.e., given a set S of n numbers and the task is to find two disjoint, nonempty subsets A, B ⊆ S, such that |Σ(A) − Σ(B)| is minimized (details in the paper). Extra Result: Polynomial space algorithm Equal-Subset-Sum can be solved in O∗ (2.6817n) time and polynomial space (cf. naive algorithm needs O∗ (3n) time and polynomial space)
SLIDE 88
New algorithm for Equal-Subset-Sum: Our results
Main theorem Equal-Subset-Sum can be solved in O∗ (1.7088n) time (meet-in-the-middle gives O∗ 3n/2 ≤ O∗ (1.7321n). This also extends to the exact algorithm for Number Balancing, i.e., given a set S of n numbers and the task is to find two disjoint, nonempty subsets A, B ⊆ S, such that |Σ(A) − Σ(B)| is minimized (details in the paper). Extra Result: Polynomial space algorithm Equal-Subset-Sum can be solved in O∗ (2.6817n) time and polynomial space (cf. naive algorithm needs O∗ (3n) time and polynomial space) assuming read-only access to exponential number of random bits.
SLIDE 89
New algorithm for Equal-Subset-Sum: Our results
Main theorem Equal-Subset-Sum can be solved in O∗ (1.7088n) time (meet-in-the-middle gives O∗ 3n/2 ≤ O∗ (1.7321n). This also extends to the exact algorithm for Number Balancing, i.e., given a set S of n numbers and the task is to find two disjoint, nonempty subsets A, B ⊆ S, such that |Σ(A) − Σ(B)| is minimized (details in the paper). Extra Result: Polynomial space algorithm Equal-Subset-Sum can be solved in O∗ (2.6817n) time and polynomial space (cf. naive algorithm needs O∗ (3n) time and polynomial space) assuming read-only access to exponential number of random bits. We use techniques by [Bansal et al.], who gave an O∗ 20.86n time and polynomial space algorithm for Subset Sum.
SLIDE 90 Open Problems
Improve Meet-in-the-Middle for Subset Sum.
Give O∗ 1.99n/2 algorithm.
- r, give a conditional lower bound on Subset Sum. e.g., O∗
1.99n/2 would break SETH.
SLIDE 91 Open Problems
Improve Meet-in-the-Middle for Subset Sum.
Give O∗ 1.99n/2 algorithm.
- r, give a conditional lower bound on Subset Sum. e.g., O∗
1.99n/2 would break SETH.
Total Search Problems: When Σ(S) < 2n − 1 answer to Equal-Subset-Sum is YES. Can we find solution faster than 2o(n)? Papadimitriou ’94 asked to show it is PPP-hard
SLIDE 92 Open Problems
Improve Meet-in-the-Middle for Subset Sum.
Give O∗ 1.99n/2 algorithm.
- r, give a conditional lower bound on Subset Sum. e.g., O∗
1.99n/2 would break SETH.
Total Search Problems: When Σ(S) < 2n − 1 answer to Equal-Subset-Sum is YES. Can we find solution faster than 2o(n)? Papadimitriou ’94 asked to show it is PPP-hard Number Balancing: given n numbers a1, . . . , an ∈ [0, 1]. Find two disjoint subsets of them such that their difference |Σ(A1) − Σ(A2)| is minimized. Karmarkar and Karp (’82) showed polynomial algorithm with difference at most n−θ(log n). Observe: There
always exists a solution with difference at most O(
√n 2n ) but it seems hard to find.
SLIDE 93 Open Problems
Improve Meet-in-the-Middle for Subset Sum.
Give O∗ 1.99n/2 algorithm.
- r, give a conditional lower bound on Subset Sum. e.g., O∗
1.99n/2 would break SETH.
Total Search Problems: When Σ(S) < 2n − 1 answer to Equal-Subset-Sum is YES. Can we find solution faster than 2o(n)? Papadimitriou ’94 asked to show it is PPP-hard Number Balancing: given n numbers a1, . . . , an ∈ [0, 1]. Find two disjoint subsets of them such that their difference |Σ(A1) − Σ(A2)| is minimized. Karmarkar and Karp (’82) showed polynomial algorithm with difference at most n−θ(log n). Observe: There
always exists a solution with difference at most O(
√n 2n ) but it seems hard to find.
For Equal-Subset-Sum we showed: ◮ Upper bound: O∗ (1.7088n), ◮ Lower bound: O∗ (1.188n) algorithm implies O∗ 1.99n/2 for Subset Sum. Open Problem: Match (improve?) lower and upper bounds for Equal-Subset-Sum.
SLIDE 94
Equal-Subset-Sum in O∗ (1.7088n) time and exponential space. Equal-Subset-Sum in O∗ (2.6817n) time and polynomial space.
Thank you!
SLIDE 95
Extra: Polynomial Space Algorithm
Element Distinctness: given read-only access to the elements of a list of n elements. Find two different elements of the same value.
SLIDE 96 Extra: Polynomial Space Algorithm
Element Distinctness: given read-only access to the elements of a list of n elements. Find two different elements of the same value. Element distinctness can be solved in: ◮ O
time and O (1) space (naive), ◮ O (n) time and O (n) space (sorting),
SLIDE 97 Extra: Polynomial Space Algorithm
Element Distinctness: given read-only access to the elements of a list of n elements. Find two different elements of the same value. Element distinctness can be solved in: ◮ O
time and O (1) space (naive), ◮ O (n) time and O (n) space (sorting), ◮ O
time and O (1) space.
(
[Beame et al.] access to random hash function)
SLIDE 98 Extra: Polynomial Space Algorithm
Element Distinctness: given read-only access to the elements of a list of n elements. Find two different elements of the same value. Element distinctness can be solved in: ◮ O
time and O (1) space (naive), ◮ O (n) time and O (n) space (sorting), ◮ O
time and O (1) space.
(
[Beame et al.] access to random hash function)
Simple algorithm for Equal-Subset-Sum:
- 1. Prepare list of 2n subsets of S,
In polynomial space
O
algorithm for element distinctness. Running time: O∗ 21.5n = O∗ (2.83n). With extra work we can get O∗ (2.6817n) time and polynomial space (with read-only access to exponential number of random bits).
SLIDE 99 Extra: Polynomial Space Algorithm
Let A, B ⊆ S, such that Σ(A) = Σ(B) and a = |A| and b = |B|. Algorithm 1: (previous slide) We can solve Equal-Subset-Sum in time O∗ n
a
n
b
1.5 .
SLIDE 100 Extra: Polynomial Space Algorithm
Let A, B ⊆ S, such that Σ(A) = Σ(B) and a = |A| and b = |B|. Algorithm 1: (previous slide) We can solve Equal-Subset-Sum in time O∗ n
a
n
b
1.5 . Algorithm 2: Equal-Subset-Sum in O∗ n
a
.
Time O∗( n
a
- )
- 2. Partition S \ A into S1 and S2.
|S1| = |S2| = (n − a)/2
- 3. Let L1 = [Σ(X) | X ⊆ S1].
|L1| = 2(n−a)/2
- 4. Let L2 = [Σ(A) − Σ(Y ) | Y ⊆ S2].
|L2| = 2(n−a)/2
- 5. Solve Element distinctness on L1 ∪ L2
Time O∗((|L1| + |L2|)1.5)
SLIDE 101 Extra: Polynomial Space Algorithm
Let A, B ⊆ S, such that Σ(A) = Σ(B) and a = |A| and b = |B|. Algorithm 1: (previous slide) We can solve Equal-Subset-Sum in time O∗ n
a
n
b
1.5 . Algorithm 2: Equal-Subset-Sum in O∗ n
a
. Algorithm 3: Equal-Subset-Sum in O∗ n
b
. Combining above algorithms yields the desired running time.
SLIDE 102 Extra: Polynomial Space Algorithm
Let A, B ⊆ S, such that Σ(A) = Σ(B) and a = |A| and b = |B|. Algorithm 1: (previous slide) We can solve Equal-Subset-Sum in time O∗ n
a
n
b
1.5 . Algorithm 2: Equal-Subset-Sum in O∗ n
a
. Algorithm 3: Equal-Subset-Sum in O∗ n
b
. Combining above algorithms yields the desired running time. Equal-Subset-Sum can be solved in O∗ (2.6817n) time and polynomial space.
(with read-only access to exponential number of random bits)