equal subset sum faster than the meet in the middle
play

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


  1. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in time O ∗ � 2 n/ 2 � Σ( S ) = t . Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 2 n/ 2 � A, B ⊆ S , such that Σ( A ) = Σ( B ) . S [Folklore] Algorithm: For every number a ∈ S , decide if a is in 81 80 43 40 30 26 17 11 9 15 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 ∗ (3 n ) .

  2. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in time O ∗ � 2 n/ 2 � Σ( S ) = t . Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 2 n/ 2 � A, B ⊆ S , such that Σ( A ) = Σ( B ) . S [Folklore] Algorithm: For every number a ∈ S , decide if a is in 81 80 43 40 30 26 17 11 9 15 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 ∗ (3 n ) .

  3. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in time O ∗ � 2 n/ 2 � Σ( S ) = t . Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 2 n/ 2 � A, B ⊆ S , such that Σ( A ) = Σ( B ) . S [Folklore] Algorithm: For every number a ∈ S , decide if a is in 81 80 43 40 30 26 17 11 9 15 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 ∗ (3 n ) .

  4. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in time O ∗ � 2 n/ 2 � Σ( S ) = t . Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 2 n/ 2 � A, B ⊆ S , such that Σ( A ) = Σ( B ) . S [Folklore] Algorithm: For every number a ∈ S , decide if a is in 81 80 43 40 30 26 17 11 9 15 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 ∗ (3 n ) .

  5. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in time O ∗ � 2 n/ 2 � Σ( S ) = t . Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 2 n/ 2 � A, B ⊆ S , such that Σ( A ) = Σ( B ) . S [Folklore] Algorithm: For every number a ∈ S , decide if a is in 81 80 43 40 30 26 17 11 9 15 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 ∗ (3 n ) .

  6. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in time O ∗ � 2 n/ 2 � Σ( S ) = t . Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 2 n/ 2 � A, B ⊆ S , such that Σ( A ) = Σ( B ) . S [Folklore] Algorithm: For every number a ∈ S , decide if a is in 81 80 43 40 30 26 17 11 9 15 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 ∗ (3 n ) .

  7. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in time O ∗ � 2 n/ 2 � Σ( S ) = t . Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 2 n/ 2 � A, B ⊆ S , such that Σ( A ) = Σ( B ) . S [Folklore] Algorithm: For every number a ∈ S , decide if a is in 81 80 43 40 30 26 17 11 9 15 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 ∗ (3 n ) .

  8. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in time O ∗ � 2 n/ 2 � Σ( S ) = t . Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 2 n/ 2 � A, B ⊆ S , such that Σ( A ) = Σ( B ) . S [Folklore] Algorithm: For every number a ∈ S , decide if a is in 81 80 43 40 30 26 17 11 9 15 A , B or S \ ( A ∪ B ) . Check if ↑ Σ( A ) = Σ( B ) . Running time: YES: Σ( A ) = Σ( B ) There are n guesses. Each guess has 3 choices. Hence running time is O ∗ (3 n ) .

  9. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 3 n/ 2 � A, B ⊆ S , such that . Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Horowitz and Sahni 1974] 1. Arbitrarily partition S = S 1 ∪ S 2 .

  10. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 3 n/ 2 � A, B ⊆ S , such that . Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Horowitz and Sahni 1974] 1. Arbitrarily partition S = S 1 ∪ S 2 . Σ( S ′ 1 ) 2. Enumerate L = 2 S 1 , | L | = 2 n/ 2 . . . L = 2 S 1

  11. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 3 n/ 2 � A, B ⊆ S , such that . Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Horowitz and Sahni 1974] 1. Arbitrarily partition S = S 1 ∪ S 2 . 2. Enumerate L = 2 S 1 , | L | = 2 n/ 2 Note that | L | = O ∗ � 2 n/ 2 � . . . L = 2 S 1 (Guess if a ∈ S 1 in A or not)

  12. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 3 n/ 2 � A, B ⊆ S , such that . Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Horowitz and Sahni 1974] 1. Arbitrarily partition S = S 1 ∪ S 2 . 2. Enumerate L = 2 S 1 , | L | = 2 n/ 2 | R | = 2 n/ 2 3. Enumerate R = 2 S 2 , . . . . . . L = 2 S 1 R = 2 S 2

  13. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 3 n/ 2 � A, B ⊆ S , such that . Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Horowitz and Sahni 1974] 1. Arbitrarily partition S = S 1 ∪ S 2 . 2. Enumerate L = 2 S 1 , | L | = 2 n/ 2 | R | = 2 n/ 2 3. Enumerate R = 2 S 2 , . . 4. Sort R , O ∗ ( | R | log | R | ) . . . . L = 2 S 1 R = 2 S 2

  14. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in time O ∗ � 3 n/ 2 � A, B ⊆ S , such that . Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Horowitz and Sahni 1974] 1. Arbitrarily partition S = S 1 ∪ S 2 . 2. Enumerate L = 2 S 1 , | L | = 2 n/ 2 | R | = 2 n/ 2 3. Enumerate R = 2 S 2 , t − a . . 4. Sort R , O ∗ ( | R | log | R | ) . . . . L = 2 S 1 R = 2 S 2 a do binary search 5. For a ∈ L : ◮ check if ( t − a ) ∈ R ◮ if yes, return true 6. return false

  15. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( A ) = Σ( B ) .

  16. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Woeginger 2004] 1. Arbitrarily partition S = S 1 ∪ S 2 .

  17. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Woeginger 2004] 1. Arbitrarily partition S = S 1 ∪ S 2 . Σ( A ) − Σ( B ) 2. L = { Σ( A ) − Σ( B ) | A ⊆ S 1 , B ⊆ S 1 \ A } , . . . L

  18. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Woeginger 2004] 1. Arbitrarily partition S = S 1 ∪ S 2 . Σ( A ) − Σ( B ) 2. L = { Σ( A ) − Σ( B ) | A ⊆ S 1 , B ⊆ S 1 \ A } , . . Note that | L | = O ∗ � 3 n/ 2 � . L (Guess if a ∈ S 1 in A or B or neither)

  19. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Woeginger 2004] 1. Arbitrarily partition S = S 1 ∪ S 2 . Σ( A ) − Σ( B ) 2. L = { Σ( A ) − Σ( B ) | A ⊆ S 1 , B ⊆ S 1 \ A } , . . . . 3. R = { Σ( A ) − Σ( B ) | A ⊆ S 2 , B ⊆ S 2 \ A } . . L R

  20. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Woeginger 2004] 1. Arbitrarily partition S = S 1 ∪ S 2 . Σ( A ) − Σ( B ) 2. L = { Σ( A ) − Σ( B ) | A ⊆ S 1 , B ⊆ S 1 \ A } , . . . . 3. R = { Σ( A ) − Σ( B ) | A ⊆ S 2 , B ⊆ S 2 \ A } . . L R

  21. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Woeginger 2004] 1. Arbitrarily partition S = S 1 ∪ S 2 . Σ( A ) − Σ( B ) 2. L = { Σ( A ) − Σ( B ) | A ⊆ S 1 , B ⊆ S 1 \ A } , . . . . 3. R = { Σ( A ) − Σ( B ) | A ⊆ S 2 , B ⊆ S 2 \ A } . . − x 4. Find x ∈ L and y ∈ R , s.t., x + y = 0 L R x

  22. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( A ) = Σ( B ) . S 1 = { a 1 , . . . , a n/ 2 } S 2 = { a n/ 2+1 , . . . , a n } Algorithm: [Woeginger 2004] 1. Arbitrarily partition S = S 1 ∪ S 2 . Σ( A ) − Σ( B ) 2. L = { Σ( A ) − Σ( B ) | A ⊆ S 1 , B ⊆ S 1 \ A } , . . . . 3. R = { Σ( A ) − Σ( B ) | A ⊆ S 2 , B ⊆ S 2 \ A } . . − x 4. Find x ∈ L and y ∈ R , s.t., x + y = 0 L R x Analysis: If Σ( A 1 ) − Σ( B 1 ) = − Σ( A 2 ) + Σ( B 2 ) , then Σ( A 1 ∪ A 2 ) = Σ( B 1 ∪ B 2 ) . Running time: | L | = | R | = O ∗ (3 n/ 2 )

  23. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( A ) = Σ( B ) .

  24. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( 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 !

  25. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( 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 . 7321 n ) Meet-in-the-Middle deterministic O ∗ (1 . 7088 n ) This talk New running time: randomized

  26. Naive : Subset-Sum in O ∗ (2 n ) time Subset Sum : Given S, t . Find S ′ ⊆ S , that Meet-in-the-Middle : Subset-Sum in O ∗ � 2 n/ 2 � Σ( S ) = t . time Naive: Equal-Subset-Sum in O ∗ (3 n ) time. Equal-Subset-Sum : Given S . Find nonempty, different Meet-in-the-Middle: Equal-Subset-Sum in O ∗ � 3 n/ 2 � A, B ⊆ S , such that time. Σ( 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 . 7321 n ) Meet-in-the-Middle deterministic O ∗ (1 . 7088 n ) This talk New running time: randomized Rest of the talk: O ∗ (1 . 7088 n ) algorithm for Equal-Subset-Sum.

  27. 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)

  28. 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: �� n/ 2 � � O ∗ 2 ℓ/ 2 . ℓ/ 2

  29. 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: �� n/ 2 � � O ∗ 2 ℓ/ 2 . ℓ/ 2 S = { a 1 , . . . , a n } Given set | S | = n

  30. 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: �� n/ 2 � � O ∗ 2 ℓ/ 2 . ℓ/ 2 S 1 S 2 Randomly partition S into | S 1 | = | S 2 | = n/ 2

  31. 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: �� n/ 2 � � O ∗ 2 ℓ/ 2 . ℓ/ 2 S 1 S 2 A 1 ∪ B 1 � n/ 2 � Enumarate A 1 ∪ B 1 from S 1 in ℓ/ 2

  32. 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: �� n/ 2 � � O ∗ 2 ℓ/ 2 . ℓ/ 2 S 1 S 2 A 1 B 1 Enumarate partitions of A 1 ∪ B 1 into A 1 and B 1 in 2 ℓ/ 2 .

  33. 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: �� n/ 2 � � O ∗ 2 ℓ/ 2 . ℓ/ 2 S 1 S 2 A 1 B 1 A 2 B 2 � n/ 2 � 2 ℓ/ 2 Do the same for A 2 and B 2 in ℓ/ 2

  34. 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: �� n/ 2 � � O ∗ 2 ℓ/ 2 . ℓ/ 2 S 1 S 2 A 1 B 1 A 2 B 2 Use meet-in-the-middle: Σ( A 1 ) − Σ( B 1 ) = Σ( B 2 ) − Σ( A 2 ) .

  35. 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: �� n/ 2 � � O ∗ 2 ℓ/ 2 . ℓ/ 2 S 1 S 2 A 1 B 1 A 2 B 2 Analysis: If S 1 and S 2 are random then | S 1 ∩ ( A ∪ B ) | = ℓ/ 2 (whp.)

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

  37. 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 3 , then O ∗ �� n/ 2 2 n/ 3 � Exponent of the running time 1.73 � = O ∗ � 3 n/ 2 � If ℓ n = 2 . n/ 3 0.66 Parameter l/n

  38. 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 3 , then O ∗ �� n/ 2 2 n/ 3 � Exponent of the running time 1.73 � = O ∗ � 3 n/ 2 � If ℓ n = 2 . n/ 3 Observe that for ℓ ∈ ( 2 3 − ε, 2 n / 3 + ε ) , running time is O ∗ � (3 − ε ′ ) n/ 2 � ! 0.66 Parameter l/n

  39. 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 3 , then O ∗ �� n/ 2 2 n/ 3 � Exponent of the running time 1.73 � = O ∗ � 3 n/ 2 � If ℓ n = 2 . n/ 3 Observe that for ℓ ∈ ( 2 3 − ε, 2 n / 3 + ε ) , running time is O ∗ � (3 − ε ′ ) n/ 2 � ! 0.66 Parameter l/n The hardest case is ℓ ≈ 2 n 3

  40. New algorithm for Equal-Subset-Sum: hard case Goal : We want to detect minimum solution A, B ⊆ S with | A ∪ B | ≈ 2 n 3 . What combinatorial property can we use then?

  41. New algorithm for Equal-Subset-Sum: hard case Goal : We want to detect minimum solution A, B ⊆ S with | A ∪ B | ≈ 2 n 3 . What combinatorial property can we use then? Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . A X B S Proof : If a pair ( A, B ) is a solution, then Σ( A ∪ X ) = Σ( B ∪ X ) . Moreover there are 2 n/ 3 different choices of X and by minimality all X are different.

  42. How to use combinatorial lemma? Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Idea: Hash all 2 n subsets of S into p = 2 n/ 3 buckets

  43. How to use combinatorial lemma? Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Idea: Hash all 2 n subsets of S into p = 2 n/ 3 buckets . . . . . . C p C 1 C 2 C 3 C 4 C 5 C 6

  44. How to use combinatorial lemma? Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Idea: Hash all 2 n subsets of S into p = 2 n/ 3 buckets . . . . . . C p C 1 C 2 C 3 C 4 C 5 C 6

  45. How to use combinatorial lemma? Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Idea: Hash all 2 n subsets of S into p = 2 n/ 3 buckets Hash function : C t = { X ⊆ S | Σ( X ) ≡ p t } . . . . . . C p C 1 C 2 C 3 C 4 C 5 C 6

  46. How to use combinatorial lemma? Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Idea: Hash all 2 n subsets of S into p = 2 n/ 3 buckets Hash function : C t = { X ⊆ S | Σ( X ) ≡ p t } Properties : ◮ E [ C t ] = 2 n p = 2 2 n/ 3 2 n p . . . . . . C p C 1 C 2 C 3 C 4 C 5 C 6 p

  47. How to use combinatorial lemma? Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Idea: Hash all 2 n subsets of S into p = 2 n/ 3 buckets Hash function : C t = { X ⊆ S | Σ( X ) ≡ p t } Properties : ◮ E [ C t ] = 2 n p = 2 2 n/ 3 2 n p ◮ Each C t contains pair . . . Σ( A ) = Σ( B ) (whp) . . . C p C 1 C 2 C 3 C 4 C 5 C 6 p

  48. How to use combinatorial lemma? Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Idea: Hash all 2 n subsets of S into p = 2 n/ 3 buckets Hash function : C t = { X ⊆ S | Σ( X ) ≡ p t } Properties : ◮ E [ C t ] = 2 n p = 2 2 n/ 3 2 n p ◮ Each C t contains pair . . . Σ( A ) = Σ( B ) (whp) We can restrict attention to . . . C p C 1 C 2 C 3 C 4 C 5 C 6 find a duplicate in a single bucket. p

  49. New algorithm for Equal-Subset-Sum: when | A ∪ B | ≈ 2 n 3 Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s .

  50. New algorithm for Equal-Subset-Sum: when | A ∪ B | ≈ 2 n 3 Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Algorithm: 1. Pick a random prime p of order 2 n/ 3 and a random t ∈ { 1 , . . . 2 n/ 3 } Properties:

  51. New algorithm for Equal-Subset-Sum: when | A ∪ B | ≈ 2 n 3 Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Algorithm: 1. Pick a random prime p of order 2 n/ 3 and a random t ∈ { 1 , . . . 2 n/ 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.)

  52. New algorithm for Equal-Subset-Sum: when | A ∪ B | ≈ 2 n 3 Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Algorithm: 1. Pick a random prime p of order 2 n/ 3 and a random t ∈ { 1 , . . . 2 n/ 3 } 2. Let C = { X ⊆ S | Σ( X ) ≡ p t } Hash and choose a random bucket In time O ∗ � | C | + 2 n/ 2 � 3. Enumerate C with meet-in-the-middle Properties: 1. C contains X, Y , such that Σ( X ) = Σ( Y ) (whp.) 2. E [ | C | ] = O ∗ � 2 2 n/ 3 �

  53. New algorithm for Equal-Subset-Sum: when | A ∪ B | ≈ 2 n 3 Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Algorithm: 1. Pick a random prime p of order 2 n/ 3 and a random t ∈ { 1 , . . . 2 n/ 3 } 2. Let C = { X ⊆ S | Σ( X ) ≡ p t } Hash and choose a random bucket In time O ∗ � | C | + 2 n/ 2 � 3. Enumerate C 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 ∗ � 2 2 n/ 3 � 3. We can find X, Y ∈ C in O ∗ ( | C | log | C | ) time by sorting.

  54. New algorithm for Equal-Subset-Sum: when | A ∪ B | ≈ 2 n 3 Combinatorial Lemma : If A, B ⊆ S is a minimum solution of size 2 n 3 , then there are at least 2 n/ 3 different s and nontrivial A s , B s ⊆ S with Σ( A s ) = Σ( B s ) = s . Algorithm: 1. Pick a random prime p of order 2 n/ 3 and a random t ∈ { 1 , . . . 2 n/ 3 } 2. Let C = { X ⊆ S | Σ( X ) ≡ p t } Hash and choose a random bucket In time O ∗ � | C | + 2 n/ 2 � 3. Enumerate C 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 ∗ � 2 2 n/ 3 � 3. We can find X, Y ∈ C in O ∗ ( | C | log | C | ) time by sorting. Running time : O ∗ ( | C | log | C | ) = O ∗ � 2 2 n/ 3 � ≪ O ∗ � 3 n/ 2 � for the hardest case!

  55. New algorithm for Equal-Subset-Sum: Generalization 3 , then algorithm runs in O ∗ � 2 2 n/ 3 � We saw : if ℓ = 2 n time. Will it generalize to O ∗ � 2 ℓ � ?

  56. New algorithm for Equal-Subset-Sum: Generalization 3 , then algorithm runs in O ∗ � 2 2 n/ 3 � We saw : if ℓ = 2 n time. Will it generalize to O ∗ � 2 ℓ � ? YES with a small technical detail. . . .

  57. New algorithm for Equal-Subset-Sum: Generalization 3 , then algorithm runs in O ∗ � 2 2 n/ 3 � We saw : if ℓ = 2 n 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 2 , then there are at least 2 n − ℓ different s and nontrivial A s , B s ⊆ S with ℓ > n Σ( A s ) = Σ( B s ) = s .

  58. New algorithm for Equal-Subset-Sum: Generalization 3 , then algorithm runs in O ∗ � 2 2 n/ 3 � We saw : if ℓ = 2 n 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 2 , then there are at least 2 n − ℓ different s and nontrivial A s , B s ⊆ S with ℓ > n Σ( A s ) = Σ( B s ) = s . X 1 X 2 A B S When ℓ < n 2 there may be some X 1 , X 2 that Σ( X 1 ) = Σ( X 2 ) !

  59. New algorithm for Equal-Subset-Sum: Generalization 3 , then algorithm runs in O ∗ � 2 2 n/ 3 � We saw : if ℓ = 2 n 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 2 , then there are at least 2 n − ℓ different s and nontrivial A s , B s ⊆ S with ℓ > n Σ( A s ) = Σ( B s ) = s . X 1 X 2 A B S When ℓ < n 2 there may be some X 1 , X 2 that Σ( X 1 ) = Σ( X 2 ) ! Algorithm for general ℓ : choose p, t ≈ 2 n − ℓ . Then E [ | C t,p | ] ≈ 2 ℓ and algorithm runs in time O ∗ � 2 ℓ � when ℓ > n 2 .

  60. New algorihm for Equal-Subset-Sum: Tradeoff Algorithm 1 (Meet-in-the-Middle) : Running time O ∗ �� n/ 2 2 ℓ/ 2 � � ℓ/ 2

  61. New algorihm for Equal-Subset-Sum: Tradeoff Algorithm 1 (Meet-in-the-Middle) : Running time O ∗ �� n/ 2 2 ℓ/ 2 � � 1.7321 ℓ/ 2

  62. New algorihm for Equal-Subset-Sum: Tradeoff Algorithm 1 (Meet-in-the-Middle) : Running time O ∗ �� n/ 2 2 ℓ/ 2 � � 1.7321 ℓ/ 2 Algorithm 2 (Previous slides) : Running time O ∗ � 2 ℓ � (only if ℓ > n 2 )

  63. New algorihm for Equal-Subset-Sum: Tradeoff Algorithm 1 (Meet-in-the-Middle) : Running time O ∗ �� n/ 2 2 ℓ/ 2 � � 1.7321 ℓ/ 2 1.7088 Algorithm 2 (Previous slides) : Running time O ∗ � 2 ℓ � (only if ℓ > n 2 ) Tradeoff : Guess ℓ (polynomial overhead) and run the faster algorithm.

  64. New algorihm for Equal-Subset-Sum: Tradeoff Algorithm 1 (Meet-in-the-Middle) : Running time O ∗ �� n/ 2 2 ℓ/ 2 � � 1.7321 ℓ/ 2 1.7088 Algorithm 2 (Previous slides) : Running time O ∗ � 2 ℓ � (only if ℓ > n 2 ) Tradeoff : Guess ℓ (polynomial overhead) and run the faster algorithm. � � �� n/ 2 � ��� 2 ℓ/ 2 , 2 ℓ O ∗ max min ℓ/ 2 ℓ

  65. New algorihm for Equal-Subset-Sum: Tradeoff Algorithm 1 (Meet-in-the-Middle) : Running time O ∗ �� n/ 2 2 ℓ/ 2 � � 1.7321 ℓ/ 2 1.7088 Algorithm 2 (Previous slides) : Running time O ∗ � 2 ℓ � (only if ℓ > n 2 ) Tradeoff : Guess ℓ (polynomial overhead) and run the faster algorithm. � � �� n/ 2 � ��� � 2 ( h ( α )+ α ) , 2 αn ��� � � n 2 ℓ/ 2 , 2 ℓ O ∗ = O ∗ max min max min 2 ℓ/ 2 ℓ ℓ Notation: ℓ = αn and h ( α ) = − α log 2 α − (1 − α ) log 2 1 − α .

  66. New algorihm for Equal-Subset-Sum: Tradeoff Algorithm 1 (Meet-in-the-Middle) : Running time O ∗ �� n/ 2 2 ℓ/ 2 � � 1.7321 ℓ/ 2 1.7088 Algorithm 2 (Previous slides) : Running time O ∗ � 2 ℓ � (only if ℓ > n 2 ) Tradeoff : Guess ℓ (polynomial overhead) and run the faster algorithm. � � �� n/ 2 � ��� � 2 ( h ( α )+ α ) , 2 αn ��� � � n 2 ℓ/ 2 , 2 ℓ O ∗ = O ∗ max min max min 2 ℓ/ 2 ℓ ℓ By numeric calculations α ≈ 0 . 773 , when h ( α ) = α and 2 αn ≈ 1 . 7088 n . Notation: ℓ = αn and h ( α ) = − α log 2 α − (1 − α ) log 2 1 − α .

  67. New algorithm for Equal-Subset-Sum: Our results Main theorem Equal-Subset-Sum can be solved in O ∗ (1 . 7088 n ) time (meet-in-the-middle gives O ∗ � 3 n/ 2 � ≤ O ∗ (1 . 7321 n ) .

  68. New algorithm for Equal-Subset-Sum: Our results Main theorem Equal-Subset-Sum can be solved in O ∗ (1 . 7088 n ) time (meet-in-the-middle gives O ∗ � 3 n/ 2 � ≤ O ∗ (1 . 7321 n ) . 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) .

  69. New algorithm for Equal-Subset-Sum: Our results Main theorem Equal-Subset-Sum can be solved in O ∗ (1 . 7088 n ) time (meet-in-the-middle gives O ∗ � 3 n/ 2 � ≤ O ∗ (1 . 7321 n ) . 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 . 6817 n ) time and polynomial space (cf. naive algorithm needs O ∗ (3 n ) time and polynomial space)

  70. New algorithm for Equal-Subset-Sum: Our results Main theorem Equal-Subset-Sum can be solved in O ∗ (1 . 7088 n ) time (meet-in-the-middle gives O ∗ � 3 n/ 2 � ≤ O ∗ (1 . 7321 n ) . 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 . 6817 n ) time and polynomial space (cf. naive algorithm needs O ∗ (3 n ) time and polynomial space) assuming read-only access to exponential number of random bits.

  71. New algorithm for Equal-Subset-Sum: Our results Main theorem Equal-Subset-Sum can be solved in O ∗ (1 . 7088 n ) time (meet-in-the-middle gives O ∗ � 3 n/ 2 � ≤ O ∗ (1 . 7321 n ) . 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 . 6817 n ) time and polynomial space (cf. naive algorithm needs O ∗ (3 n ) 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 ∗ � 2 0 . 86 n � time and polynomial space algorithm for Subset Sum.

  72. Open Problems Give O ∗ � 1 . 99 n/ 2 � Improve Meet-in-the-Middle for Subset Sum . algorithm. or, give a conditional lower bound on Subset Sum . e.g., O ∗ � 1 . 99 n/ 2 � would break SETH.

  73. Open Problems Give O ∗ � 1 . 99 n/ 2 � Improve Meet-in-the-Middle for Subset Sum . algorithm. or, give a conditional lower bound on Subset Sum . e.g., O ∗ � 1 . 99 n/ 2 � would break SETH. Total Search Problems: When Σ( S ) < 2 n − 1 answer to Equal-Subset-Sum is YES. Can we find solution faster than 2 o ( n ) ? Papadimitriou ’94 asked to show it is PPP-hard

  74. Open Problems Give O ∗ � 1 . 99 n/ 2 � Improve Meet-in-the-Middle for Subset Sum . algorithm. or, give a conditional lower bound on Subset Sum . e.g., O ∗ � 1 . 99 n/ 2 � would break SETH. Total Search Problems: When Σ( S ) < 2 n − 1 answer to Equal-Subset-Sum is YES. Can we find solution faster than 2 o ( n ) ? Papadimitriou ’94 asked to show it is PPP-hard Number Balancing : given n numbers a 1 , . . . , a n ∈ [0 , 1] . Find two disjoint subsets of them such that their difference | Σ( A 1 ) − Σ( A 2 ) | is minimized. Karmarkar and Karp (’82) showed polynomial algorithm with difference at most n − θ (log n ) . Observe: There √ n always exists a solution with difference at most O ( 2 n ) but it seems hard to find.

  75. Open Problems Give O ∗ � 1 . 99 n/ 2 � Improve Meet-in-the-Middle for Subset Sum . algorithm. or, give a conditional lower bound on Subset Sum . e.g., O ∗ � 1 . 99 n/ 2 � would break SETH. Total Search Problems: When Σ( S ) < 2 n − 1 answer to Equal-Subset-Sum is YES. Can we find solution faster than 2 o ( n ) ? Papadimitriou ’94 asked to show it is PPP-hard Number Balancing : given n numbers a 1 , . . . , a n ∈ [0 , 1] . Find two disjoint subsets of them such that their difference | Σ( A 1 ) − Σ( A 2 ) | is minimized. Karmarkar and Karp (’82) showed polynomial algorithm with difference at most n − θ (log n ) . Observe: There √ n always exists a solution with difference at most O ( 2 n ) but it seems hard to find. For Equal-Subset-Sum we showed: ◮ Upper bound : O ∗ (1 . 7088 n ) , ◮ Lower bound : O ∗ (1 . 188 n ) algorithm implies O ∗ � 1 . 99 n/ 2 � for Subset Sum. Open Problem : Match (improve?) lower and upper bounds for Equal-Subset-Sum.

  76. Equal-Subset-Sum in O ∗ (1 . 7088 n ) time and exponential space. Equal-Subset-Sum in O ∗ (2 . 6817 n ) time and polynomial space. Thank you!

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

  78. 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: � n 2 � ◮ � time and � O O (1) space (naive), ◮ � O ( n ) time and � O ( n ) space (sorting),

  79. 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: � n 2 � ◮ � time and � O O (1) space (naive), ◮ � O ( n ) time and � O ( n ) space (sorting), � n 1 . 5 � ◮ � time and � O O (1) space. ( [Beame et al.] access to random hash function)

  80. 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: � n 2 � ◮ � time and � O O (1) space (naive), ◮ � O ( n ) time and � O ( n ) space (sorting), � n 1 . 5 � ◮ � time and � O O (1) space. ( [Beame et al.] access to random hash function) Simple algorithm for Equal-Subset-Sum : 1. Prepare list of 2 n subsets of S , In polynomial space � n 1 . 5 � 2. Use � O algorithm for element distinctness. Running time : O ∗ � 2 1 . 5 n � = O ∗ (2 . 83 n ) . With extra work we can get O ∗ (2 . 6817 n ) time and polynomial space (with read-only access to exponential number of random bits) .

  81. 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 �� 1 . 5 � � � n + . a b

  82. 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 �� 1 . 5 � � � n + . a b Algorithm 2: Equal-Subset-Sum in O ∗ �� n � 2 0 . 75( n − a ) � . a � n � 1. Guess A Time O ∗ ( ) a 2. Partition S \ A into S 1 and S 2 . | S 1 | = | S 2 | = ( n − a ) / 2 3. Let L 1 = [Σ( X ) | X ⊆ S 1 ] . | L 1 | = 2 ( n − a ) / 2 | L 2 | = 2 ( n − a ) / 2 4. Let L 2 = [Σ( A ) − Σ( Y ) | Y ⊆ S 2 ] . 5. Solve Element distinctness on L 1 ∪ L 2 Time O ∗ (( | L 1 | + | L 2 | ) 1 . 5 )

Recommend


More recommend