Equal-Subset-Sum faster than the Meet-in-the-Middle Marcin Mucha, - - PowerPoint PPT Presentation

equal subset sum faster than the meet in the middle
SMART_READER_LITE
LIVE PREVIEW

Equal-Subset-Sum faster than the Meet-in-the-Middle Marcin Mucha, - - PowerPoint PPT Presentation

Equal-Subset-Sum faster than the Meet-in-the-Middle Marcin Mucha, Jesper Nederlof, Jakub Pawlewicz, Karol Wgrzycki University of Warsaw, TU/e ESA 2019 Definitions Subset Sum : Given set S of integers, and integer t . Find A S , such that


slide-1
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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

  • 3. Enumerate R = 2S2,

|R| = 2n/2

slide-31
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

  • 3. Enumerate R = 2S2,

|R| = 2n/2

  • 4. Sort R,

O∗(|R| log |R|)

slide-32
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

  • 3. Enumerate R = 2S2,

|R| = 2n/2

  • 4. Sort R,

O∗(|R| log |R|)

  • 5. For a ∈ L:

do binary search ◮ check if (t − a) ∈ R

◮ if yes, return true

  • 6. return false
slide-33
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
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
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
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

  • r neither)

Σ(A) − Σ(B) . . . L Algorithm: [Woeginger 2004]

  • 1. Arbitrarily partition S = S1 ∪ S2.
  • 2. L = {Σ(A) − Σ(B) | A ⊆ S1, B ⊆ S1 \ A},
slide-37
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
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
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
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
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
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
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
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
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
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

  • 2ℓ/2
  • .
slide-47
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

  • 2ℓ/2
  • .

S = {a1, . . . , an} Given set |S| = n

slide-48
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

  • 2ℓ/2
  • .

S1 S2 Randomly partition S into |S1| = |S2| = n/2

slide-49
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

  • 2ℓ/2
  • .

S1 S2 A1 ∪ B1 Enumarate A1 ∪ B1 from S1 in n/2

ℓ/2

slide-50
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

  • 2ℓ/2
  • .

S1 S2 A1 B1 Enumarate partitions of A1 ∪ B1 into A1 and B1 in 2ℓ/2.

slide-51
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

  • 2ℓ/2
  • .

S1 S2 A1 B1 A2 B2 Do the same for A2 and B2 in n/2

ℓ/2

  • 2ℓ/2
slide-52
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

  • 2ℓ/2
  • .

S1 S2 A1 B1 A2 B2 Use meet-in-the-middle: Σ(A1) − Σ(B1) = Σ(B2) − Σ(A2).

slide-53
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

  • 2ℓ/2
  • .

S1 S2 A1 B1 A2 B2 Analysis: If S1 and S2 are random then |S1 ∩ (A ∪ B)| = ℓ/2 (whp.)

slide-54
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

  • 2ℓ/2

.

slide-55
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

  • 2ℓ/2

. If ℓ

n = 2 3, then O∗ n/2 n/3

  • 2n/3

= O∗ 3n/2 .

1.73 0.66 Parameter l/n Exponent of the running time

slide-56
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

  • 2ℓ/2

. If ℓ

n = 2 3, then O∗ n/2 n/3

  • 2n/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
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

  • 2ℓ/2

. If ℓ

n = 2 3, then O∗ n/2 n/3

  • 2n/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
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
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
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
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
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
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
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
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
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
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
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
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
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

  • 3. Enumerate C

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
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

  • 3. Enumerate C

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
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

  • 3. Enumerate C

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
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
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
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
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
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
SLIDE 78

New algorihm for Equal-Subset-Sum: Tradeoff

Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2

ℓ/2

  • 2ℓ/2
slide-79
SLIDE 79

New algorihm for Equal-Subset-Sum: Tradeoff

Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2

ℓ/2

  • 2ℓ/2

1.7321

slide-80
SLIDE 80

New algorihm for Equal-Subset-Sum: Tradeoff

Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2

ℓ/2

  • 2ℓ/2

Algorithm 2 (Previous slides): Running time O∗ 2ℓ (only if ℓ > n

2 ) 1.7321

slide-81
SLIDE 81

New algorihm for Equal-Subset-Sum: Tradeoff

Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2

ℓ/2

  • 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
SLIDE 82

New algorihm for Equal-Subset-Sum: Tradeoff

Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2

ℓ/2

  • 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∗

  • max

  • min

n/2 ℓ/2

  • 2ℓ/2,2ℓ
slide-83
SLIDE 83

New algorihm for Equal-Subset-Sum: Tradeoff

Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2

ℓ/2

  • 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∗

  • max

  • min

n/2 ℓ/2

  • 2ℓ/2,2ℓ
  • = O∗
  • max

  • min
  • 2

n 2 (h(α)+α),2αn

Notation: ℓ = αn and h(α) = −α log2 α − (1 − α) log2 1 − α.

slide-84
SLIDE 84

New algorihm for Equal-Subset-Sum: Tradeoff

Algorithm 1 (Meet-in-the-Middle): Running time O∗ n/2

ℓ/2

  • 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∗

  • max

  • min

n/2 ℓ/2

  • 2ℓ/2,2ℓ
  • = O∗
  • max

  • min
  • 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
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
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
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
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
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
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
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
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
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
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
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
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

  • n2

time and O (1) space (naive), ◮ O (n) time and O (n) space (sorting),

slide-97
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

  • n2

time and O (1) space (naive), ◮ O (n) time and O (n) space (sorting), ◮ O

  • n1.5

time and O (1) space.

(

[Beame et al.] access to random hash function)

slide-98
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

  • n2

time and O (1) space (naive), ◮ O (n) time and O (n) space (sorting), ◮ O

  • n1.5

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

  • 2. Use

O

  • n1.5

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
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
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

  • 20.75(n−a)

.

  • 1. Guess 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
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

  • 20.75(n−a)

. Algorithm 3: Equal-Subset-Sum in O∗ n

b

  • 20.75(n−b)

. Combining above algorithms yields the desired running time.

slide-102
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

  • 20.75(n−a)

. Algorithm 3: Equal-Subset-Sum in O∗ n

b

  • 20.75(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)