complexity theory of polynomial time problems
play

Complexity Theory of Polynomial-Time Problems Lecture 6: 3SUM Part - PowerPoint PPT Presentation

Complexity Theory of Polynomial-Time Problems Lecture 6: 3SUM Part I Karl Bringmann 3SUM given sets ,, of integers are there , , such that + + = 0 ? (we assume that we can


  1. Complexity Theory of Polynomial-Time Problems Lecture 6: 3SUM Part I Karl Bringmann

  2. 3SUM given sets 𝐡,𝐢,𝐷 of π‘œ integers are there 𝑏 ∈ 𝐡, 𝑐 ∈ 𝐢,𝑑 ∈ 𝐷 such that 𝑏 + 𝑐 + 𝑑 = 0 ? (we assume that we can add/subtract/compare input integers in constant time) trivial algorithm: 𝑃(π‘œ / ) well-known: 𝑃(π‘œ 1 ) Conjecture: no 𝑃 π‘œ 123 algorithm β†’ 3SUM-Hardness [Gajentaan,Overmars’95]

  3. More Known Algorithms trivial: 𝑃(π‘œ / ) well-known: 𝑃(π‘œ 1 ) using FFT: 𝑃(π‘œ + 𝑉 polylog𝑉) for numbers in {βˆ’π‘‰, …, 𝑉} 789 : ; (789 789 <) : using Word RAM bit-tricks: 𝑃(π‘œ 1 β‹… ; ) , 𝑃(π‘œ 1 β‹… ) 789 : < (cell size π‘₯ = Ξ©(logπ‘œ) , [Baran,Demaine,Patrascu’05] each number fits in a cell) (789 789 <) : no bit-tricks: 𝑃(π‘œ 1 β‹… ) [Gronlund,Pettie’14] 789 < we prove a simplified version: Without bit-tricks, 3SUM is in time 𝑃(π‘œ 1 β‹… =87> 789 789 < Thm: ) 789 <

  4. Equivalent Variants given sets 𝐡,𝐢,𝐷 of π‘œ integers 1) are there 𝑏 ∈ 𝐡, 𝑐 ∈ 𝐢,𝑑 ∈ 𝐷 such that 𝑏 + 𝑐 + 𝑑 = 0 ? replace 𝐷 by βˆ’π‘‘ 𝑑 ∈ 𝐷} given sets 𝐡,𝐢,𝐷 of π‘œ integers 2) are there 𝑏 ∈ 𝐡, 𝑐 ∈ 𝐢,𝑑 ∈ 𝐷 such that 𝑏 + 𝑐 = 𝑑 ? ⇔ 𝑏 + 𝑐 βˆ’ 𝑑 = 0 given sets 𝐡,𝐢,𝐷 of π‘œ integers and target 𝑒 replace 𝐷 by 𝑑 βˆ’ 𝑒 𝑑 ∈ 𝐷} 3) are there 𝑏 ∈ 𝐡, 𝑐 ∈ 𝐢,𝑑 ∈ 𝐷 such that 𝑏 + 𝑐 + 𝑑 = 𝑒 ? ⇔ 𝑏 + 𝑐 + (𝑑 βˆ’ 𝑒) = 0 4) given a set π‘Œ of π‘œ integers are there 𝑦, 𝑧, 𝑨 ∈ π‘Œ such that 𝑦 + 𝑧 + 𝑨 = 0 ? ↑ : set 𝐡, 𝐢, 𝐷 ≔ π‘Œ ↓ : set π‘Œ ≔ 𝑏 + 4𝑉 | 𝑏 ∈ 𝐡 βˆͺ 𝐢 βˆͺ {𝑑 βˆ’ 4𝑉 | 𝑑 ∈ 𝐷} where 𝐡,𝐢,𝐷 βŠ† {βˆ’π‘‰,. . , 𝑉}

  5. Outline 1) algorithm for small universe 2) quadratic algorithm 3) small decision tree 4) logfactor improvement 5) some 3SUM-hardness results

  6. Algorithm for Small Numbers 𝑃(π‘œ + 𝑉 polylog𝑉) for numbers in {βˆ’π‘‰, …, 𝑉} add 𝑉 to each number, then numbers are in {0,. . , 2𝑉} and we want 𝑏 ∈ 𝐡, 𝑐 ∈ 𝐢,𝑑 ∈ 𝐷 such that 𝑏 + 𝑐 + 𝑑 = 3𝑉 𝑦 ^ define polynomials π‘ž \ 𝑦 ≔ βˆ‘ and similarly π‘ž _ 𝑦 , π‘ž ` 𝑦 ^∈\ have degree at most 2𝑉 𝑦 ^ 𝑦 b 𝑦 c compute π‘Ÿ 𝑦 ≔ π‘ž \ 𝑦 β‹… π‘ž _ 𝑦 β‹… π‘ž ` 𝑦 = (βˆ‘ )(βˆ‘ )(βˆ‘ ) ^∈\ c∈` b∈_ ( 𝑦 ^ β‹… 𝑦 b β‹… 𝑦 c = 𝑦 ^fbfc ) what is the coefficient of 𝑦 /d in π‘Ÿ(𝑦) ? it is the number of (𝑏, 𝑐, 𝑑) summing to 3𝑉 use efficient polynomial multiplication (via Fast Fourier Transform): polynomials of degree 𝑒 can be multiplied in time 𝑃(𝑒 polylog𝑒)

  7. Outline 1) algorithm for small universe 2) quadratic algorithm 3) small decision tree 4) logfactor improvement 5) some 3SUM-hardness results

  8. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 if 𝑏 m + 𝑏 n < βˆ’π‘‘ : π‘˜ ≔ π‘˜ + 1 … return β€œno solution” 𝑏 <

  9. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 if 𝑏 m + 𝑏 n < βˆ’π‘‘ : π‘˜ ≔ π‘˜ + 1 … return β€œno solution” 𝑏 <

  10. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 if 𝑏 m + 𝑏 n < βˆ’π‘‘ : π‘˜ ≔ π‘˜ + 1 … return β€œno solution” 𝑏 <

  11. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 if 𝑏 m + 𝑏 n < βˆ’π‘‘ : π‘˜ ≔ π‘˜ + 1 … return β€œno solution” 𝑏 <

  12. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 if 𝑏 m + 𝑏 n < βˆ’π‘‘ : π‘˜ ≔ π‘˜ + 1 … return β€œno solution” 𝑏 <

  13. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 if 𝑏 m + 𝑏 n < βˆ’π‘‘ : π‘˜ ≔ π‘˜ + 1 … return β€œno solution” 𝑏 <

  14. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 if 𝑏 m + 𝑏 n < βˆ’π‘‘ : π‘˜ ≔ π‘˜ + 1 … return β€œno solution” 𝑏 <

  15. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 if 𝑏 m + 𝑏 n < βˆ’π‘‘ : π‘˜ ≔ π‘˜ + 1 … return β€œno solution” 𝑏 <

  16. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 if 𝑏 m + 𝑏 n < βˆ’π‘‘ : π‘˜ ≔ π‘˜ + 1 … return β€œno solution” 𝑏 <

  17. Quadratic Algorithm given a set 𝐡 of π‘œ integers are there 𝑏, 𝑐, 𝑑 ∈ 𝐡 such that 𝑏 + 𝑐 + 𝑑 = 0 ? sort 𝐡 in increasing order: 𝐡 = {𝑏 g ,… , 𝑏 < } for each 𝑑 ∈ 𝐡 : check whether there are 𝑏, 𝑐 ∈ 𝐡 s.t. 𝑏 + 𝑐 + 𝑑 = 0 initialize 𝑗 = π‘œ,π‘˜ = 1 𝑏 g 𝑏 1 𝑏 / … 𝑏 < 𝑏 g while 𝑗 > 0 and π‘˜ ≀ π‘œ : 𝑏 1 if 𝑏 m + 𝑏 n = βˆ’π‘‘ : return (𝑏 m , 𝑏 n ,𝑑) 𝑏 / if 𝑏 m + 𝑏 n > βˆ’π‘‘ : 𝑗 ≔ 𝑗 βˆ’ 1 otherwise: π‘˜ ≔ π‘˜ + 1 … return β€œno solution” time 𝑃(π‘œ) per 𝑑 ∈ 𝐡 time 𝑃(π‘œ 1 ) overall 𝑏 <

  18. Outline 1) algorithm for small universe 2) quadratic algorithm 3) small decision tree 4) logfactor improvement 5) some 3SUM-hardness results

  19. Decision Tree Complexity 3SUM has a decision tree of depth 𝑃(π‘œ //1 logπ‘œ) Thm:

Recommend


More recommend