Presentation is loading. Please wait.

Presentation is loading. Please wait.

Faster Space-Efficient Algorithms for Subset Sum

Similar presentations


Presentation on theme: "Faster Space-Efficient Algorithms for Subset Sum"β€” Presentation transcript:

1 Faster Space-Efficient Algorithms for Subset Sum
Jesper Nederlof (Eindhoven University, Netherlands) Joint work with Nikhil Bansal, Shashwat Garg, and Nikhil Vyas of 11

2 Subset Sum Given ints 𝑀 1 ,…, 𝑀 𝑛 ,𝑑,
is there π‘‹βŠ† 𝑛 with 𝑀 𝑋 := π‘–βˆˆπ‘‹ 𝑀 𝑖 =𝑑? Today: how efficiently can we solve this in the wost case? NP-complete -> exponential time Basic DP [Bellman(50’s)] runs in 𝑂 βˆ— (𝑑) time and space What if 𝑑 is huge (i.e 2 𝑛 )? of 11

3 Meet in the Middle [HS(JACM’74)]
Let L=( 𝑀 1 ,…, 𝑀 𝑛/2 ) R=( 𝑀 𝑛/2+1 ,…, 𝑀 𝑛 ) Compute all possible 2 𝑛/2 sums For each v∈π‘₯, check vβˆˆπ‘¦ Sort 𝑦 + binary search in 3: 𝑂 βˆ— (2 𝑛/2 ) time and space [SS(SICOMP’81)] improved to 𝑂 βˆ— (2 𝑛/2 ) time, 𝑂 βˆ— ( 2 𝑛/4 ) space Natural question: can we beat O βˆ— ( 2 𝑛 ) using polynomial space? 𝑀 1 ,…, 𝑀 𝑛/2 𝑀 𝑛/2+1 ,…, 𝑀 𝑛 𝑅 𝐿 x = 𝑀 𝑋 π‘‹βŠ†πΏ y = π‘‘βˆ’π‘€ 𝑋 π‘‹βŠ†π‘… of 11

4 Our contribution Main thm: SSS in 𝑂 βˆ— ( 𝑛 ) time and poly space, if given a random oracle is given. The oracle stores the random bits for us! Weaker assumption than sufficiently strong PRG’s Algo i’th bit? π‘π‘œπ‘™π‘¦(𝑛) time 0/1 of 11

5 Our contribution Main thm: SSS in 𝑂 βˆ— ( 𝑛 ) time and poly space, if given a random oracle is given. Generalization to Knapsack Further generalization to Binary IP with few constraints Random* 3SUM in 𝑂 ( 𝑛 2.5 ) time and 𝑂( log 𝑛 ) space without oracle of 11

6 Union bound over d events
Main Idea Consider w( 2 [𝑛] ) = {𝑀⋅π‘₯ : x ∈ 0,1 𝑛 } i.e. all possible 2 𝑛 sums generated by 𝑀= 𝑀 1 ,…, 𝑀 𝑛 Let 𝑑=|𝑀( 2 [𝑛] )| i.e. # distinct possible sums Case 1: If d< 𝑛 (few distinct sums) a) Hash mod 𝑂(𝑑), which makes 𝑑= 𝑂 βˆ— (𝑑) b) 𝑂 βˆ— (𝑑) time DP, but in poly space [LN(STOC’10)] Interpolates 𝑝 π‘₯ = 𝑖=1 𝑛 (1+ π‘₯ 𝑀 𝑖 ) to find coeff. of π‘₯ 𝑑 Consider w( 2 [𝑛] ) = {𝑀⋅π‘₯ : x ∈ 0,1 𝑛 } i.e. all possible 2 𝑛 sums generated by 𝑀= 𝑀 1 ,…, 𝑀 𝑛 Let 𝑑=|𝑀( 2 [𝑛] )| i.e. # distinct possible sums Case 1: If d< 𝑛 (few distinct sums) a) Hash mod 𝑂(𝑑), which makes t= 𝑂 βˆ— (𝑑) b) 𝑂 βˆ— (𝑑) time DP, but in poly space [LN(STOC’10)] Case 2: If d > 𝑛 (many distinct sums) a) Upper bound max bin size via combinatorics of subset sums b) Use Floyd’s cycle finding (and the oracle ) Union bound over d events of 11

7 Main Idea Consider w( 2 [𝑛] ) = {𝑀⋅π‘₯ : x ∈ 0,1 𝑛 } i.e. all possible 2 𝑛 sums generated by 𝑀= 𝑀 1 ,…, 𝑀 𝑛 Let 𝑑=|𝑀( 2 [𝑛] )| i.e. # distinct possible sums Case 1: If d< 𝑛 (few distinct sums) a) Hash mod 𝑂(𝑑), which makes t= 𝑂 βˆ— (𝑑) b) 𝑂 βˆ— (𝑑) time DP, but in poly space [LN(STOC’10)] Case 2: If d > 𝑛 (many distinct sums) a) Upper bound max bin size via combinatorics of subset sums b) Use Floyd’s cycle finding (and the oracle ) of 11

8 οƒΎ Main Idea Lemma [AKKN(STACS’16)]: 𝑑⋅ 𝑏 π‘šπ‘Žπ‘₯ ≀ 2 1.5𝑛
Case 2: If d > 𝑛 (many distinct sums) a) Upper bound max bin size via combinatorics of subset sums οƒΎ Consider w( 2 [𝑛] ) = {𝑀⋅π‘₯ : x ∈ 0,1 𝑛 } i.e. all possible 2 𝑛 sums generated by 𝑀= 𝑀 1 ,…, 𝑀 𝑛 Let 𝑑=|𝑀( 2 [𝑛] )| i.e. # distinct possible sums Case 1: If d< 𝑛 (few distinct sums) a) Hash mod 𝑂(𝑑), which makes t= 𝑂 βˆ— (𝑑) b) 𝑂 βˆ— (𝑑) time DP, but in poly space [LN(STOC’10)] Case 2: If d > 𝑛 (many distinct sums) a) Proof max bucket size low via combinatorics of subset sums b) Use Floyd’s cycle finding (and the oracle ) max bin size 𝑏 π‘šπ‘Žπ‘₯ = π‘šπ‘Žπ‘₯ 𝑣 |{π‘₯∈{0,1 } 𝑙 :𝑀⋅π‘₯=𝑣}| Lemma [AKKN(STACS’16)]: 𝑑⋅ 𝑏 π‘šπ‘Žπ‘₯ ≀ 2 1.5𝑛 π’˜ 𝒅 𝒃 π’Žπ’‚π’™ Histogram 1 32 Cool add. comb. result Smoothness Subset Sum distrib. Proved via simple connection with `Uniquely Decodable Code Pairs’ As d > 𝑛 , 𝑏 π‘šπ‘Žπ‘₯ ≀ 𝑛 of 11

9 Meet in the Middle [HS(JACM’74)]
Let L=( 𝑀 1 ,…, 𝑀 𝑛/2 ) R=( 𝑀 𝑛/2+1 ,…, 𝑀 𝑛 ) Compute all possible 2 𝑛/2 sums For each v∈π‘₯, check vβˆˆπ‘¦ Sort 𝑦 + binary search in 3: 𝑂 βˆ— (2 𝑛/2 ) time and space Looks like the Element Distinctness problem: Given list 𝑧 of π‘š ints find two positions with equal ints, if exist Repeat 1. Define z as the concatenation of x and y 2. (Almost) uniformly sample a solution of ED instance 𝑧 3. Check if `fake’ solution or a real SSS solution U = 𝑀 1 ,…, 𝑀 𝑛/2 𝑀 𝑛/2+1 ,…, 𝑀 𝑛 𝑅 𝐿 x = 𝑀 𝑋 π‘‹βŠ†πΏ y = π‘‘βˆ’π‘€ 𝑋 π‘‹βŠ†π‘… none How many times? 𝑂 #π‘“π‘Žπ‘˜π‘’ π‘ π‘œπ‘™π‘  ≀𝑂( 𝑛 ) Using max bin bound!! of 11

10 Sample solution of ED instance
A priori for even finding a solution, 𝑂( π‘š 2 ) time seems best with polylog π‘š space Crucially relies on Floyd’s rho algorithm Thm [BCM(FOCS’13)]: ED in 𝑂 ( π‘š 1.5 ) time, 𝑂( log π‘š ) space, if given random oracle LD: Given two lists π‘₯,π‘¦βˆˆ π‘š 𝑁 , is there a common value? Define 𝑓 π‘₯,𝑦 = 𝑣=1 π‘š |π‘₯ βˆ’1 𝑣 ​ 2 + |𝑦 βˆ’1 𝑣 ​ 2 Refined analysis of [BCM(FOCS’13)]. Sample time 𝑂(π‘š/ 𝑓 ) Thm: LD In 𝑂 π‘š 𝑓 time and 𝑂( log π‘š ) space, if given fβ‰₯𝑓(π‘₯,𝑦) and random oracle of 11

11 Take-home Messages Cycle finding is a great tool low space algo’s
Win/win approach for many/few distinct sums Similar idea useful for other problems? To improve [HS(JACM’74)] it remains to `win’ in the case of few sums Thanks for listening, hope to see you at our poster! of 11


Download ppt "Faster Space-Efficient Algorithms for Subset Sum"

Similar presentations


Ads by Google