4
$\begingroup$

Given two (0ドル$-indexed) binary arrays $A$ and $B$ of size $n$, I want to compute a third array $C$ of size 2ドルn$ defined as $$ C[k] = \min\{i-j\mid i+j=k \text{ and } A[i] = B[j] = 1\} $$ And if there are no such values of $i, j$ then $C[k] = +\infty$ (notated as $\bullet$ below).

Example: let $A = [0, 1, 0, 1, 1]$ and $B = [1, 0, 1, 0, 0]$, then $C = [\bullet, 1,\bullet, -1, 4, 1, 2, \bullet, \bullet]$.

We can easily compute this in quadratic time with a double-for. Is there an $O(n^{2-\epsilon})$ algorithm for some $\epsilon > 0$? or is this false under some fine-grained conjecture?

Observation: There is a reduction to $(\min,+)$-convolution, for which there is an $n^2/2^{\Omega (\sqrt{\log n})}$ algorithm (link). The reduction goes: define arrays $A'$ and $B'$ by $$ A'[i] = \begin{cases} i &\text{ if } A[i] = 1\\ +\infty&\text{ if } A[i] = 0\\ \end{cases} $$ $$ B'[i] = \begin{cases} -i &\text{ if } B[i] = 1\\ +\infty&\text{ if } B[i] = 0\\ \end{cases} $$ Feeding these arrays to a $(\min,+)$-convolution gives the target $C$.

It has been conjectured that there is no $O(n^{2-\epsilon})$ algorithm for $(\min,+)$-convolution; indeed, a reduction the other way would answer my question, but it doesn't seem likely.

asked Oct 23 at 13:29
$\endgroup$

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.