Zeugenfindung in Minkowski-Summe von ganzen Zahlen

16

Lassen Sie AA und BB werden Teilmengen von { 0 , ... , n }{0,,n} . Wir sind daran interessiert, die Minkowski-Summe A + B = { a + b | zu finden a A , b B }  A+B={a+b | aA,bB} .

χ X : { 0 , ... , 2 n } { 0 , 1 }χX:{0,,2n}{0,1} ist eine charakteristische Funktion von XX , wenn χ X ( x ) = { 1 ,  wenn  x X 0  sonst

χX(x)={1 if xX0 otherwise

Sei ff die diskrete Faltung von χ AχA und χ BχB , dann ist x A + BxA+B genau dann, wenn f ( x ) > 0 istf(x)>0 . Somit kann A + BA+B in O ( n log n )O(nlogn) Zeit durch diskrete Faltung über FFT berechnet werden.

Manchmal ist es wichtig, das tatsächliche Paar a AaA und b B herauszufinden, das bBzu x summiert x. a AaA heißt ein Zeuge von xx , wenn es b B gibt,bB so dass a + b = xa+b=x . Eine Funktion w : A + B Aw:A+BA heißt Zeugenfunktion, wenn w ( x )w(x) ein Zeuge von x istx .

Ist es möglich, eine Zeugenfunktion in O ( n log n ) Zeit zu berechnen ?O(nlogn)

Chao Xu
quelle
3
O ( n p o l y l o g n ) ist nicht besonders schwer. O(npolylogn)
Sariel Har-Peled
2
Sie können die binäre Suche verwenden. zB Partition A in zwei ungefähr gleich große Mengen A L , A R und Berechnung von A L + B und A R + B ; überprüfe, in welchem ​​dieser x sich befindet; und rekursieren. Dadurch erhalten Sie so etwas wie O ( n lg 2 n ) . AAL,ARAL+BAR+BxO(nlg2n)
DW
@DW Dies kann nur einen Zeugen für einen einzigen finden x , aber wir wollen einen Zeugen für jedes Element in A + B . (Mein Wortlaut scheint unklar zu sein, daher habe ich die Frage gerade aktualisiert.)xA+B
Chao Xu
Aber interessieren Sie sich für O (n polylog n) -Lösung?
Sariel Har-Peled
Ja @ SarielHar-Peled, ich bin interessiert auch in determinis O ( n p o l y l o g n ) Algorithmus. O(npolylogn)
Chao Xu

Antworten:

11

Hier erkläre ich, wie man O ( n random p o l y l o g n ) zufällige Laufzeit erhält . Wir brauchen eine Abfolge von Beobachtungen:O(npolylogn)

  1. Ein Zeuge eines Wertes v ist ein Zahlenpaar ( a , b ) A × B, so dass a + b = v ist . Let P A ( x ) = Σ i A x i und P B ( x ) analog definiert werden. Beachten Sie, dass der Koeffizient von x v in P A ( x ) * P B ( xv(a,b)A×Ba+b=vPA(x)=iAxiPB(x)xv) ist die Anzahl der Zeugen für den Wert v .PA(x)PB(x)v

  2. Assume vv has a single witness (a,b)A×B(a,b)A×B, and consider the the polynomial QA(x)=iAixiQA(x)=iAixi. Clearly, the coefficient of xvxv in QA(x)PB(x)QA(x)PB(x) is aa, and as such we now know the pair (a,va)(a,va) and we are done.

  3. Wir sind also mit dem Fall fertig, dass es einen einzigen Zeugen gibt. So betrachten wir den Fall , dass v hat k Zeugen ( eine 1 , b 1 ) , ... , ( a k , b k ) . Sei i ( k ) = lg vk(a1,b1),,(ak,bk)k. Beachten Sie, dass2i(k)-1√ isti(k)=lgkk2 i ( k ) . Als nächstes seiRj=(Aj,Bj)fürj=1,...,m, fürm=O(logn)Zufallsstichproben, so dass jedes Element vonAmit der Wahrscheinlichkeitp=in Ai gewählt wird1/2 i ( k ) . Die Wahrscheinlichkeit, dassv2i(k)1k2i(k)Rj=(Aj,Bj)j=1,,mm=O(logn)AAip=1/2i(k)v has a single witness in RjRj is α=(k1)p2(1p2)k1α=(k1)p2(1p2)k1, since the witness are disjoint pairs of numbers (since the sum of each pair is vv). It is easy to verify that αα is a constant in (0,1)(0,1) independent of the value of kk. As such, it must be, with high probability, that vv has a single witness in one of the samples R1,,RmR1,,Rm. As such, by computing the two polynomials associated with with such sample, as described above, in O(nlogn)O(nlogn) time (per sample), using FFT, we can decide this in constant time.

  4. We are almost done. Compute the above random samples for resolutions i=1,,lgni=1,,lgn. For each such resolution compute the random samples and associated polynomials. Also, compute the associated polynomial for AA and BB. This preprocessing naively takes O(nlog3n)O(nlog3n), but I suspect that being slightly more careful a lognlogn factor should be removable.

  5. The algorithm: For every value vv, compute how many witness, say k, it has in constant time, by consulting the polynomial QA(x)PB(x)QA(x)PB(x). Next, go to the relevant data-structure for i(k)i(k). Then, it finds the random sample that has it as a single witness, and it extract the pair that is this witness in constant time.

  6. Strangely enough, the preprocessing time is O(nlog3n)O(nlog3n), but the expected time to find the witness themselves take only O(n)O(n) time, since one can stop the search as soon as one find a witness. This suggests that this algorithm should be improveable. In particular, for i(k)lgni(k)lgn, the polynomials generated are very sparse, and one should be able to do much faster FFT.

Sariel Har-Peled
quelle
12

Ok, I've been holding off since really Sariel should get credit for an answer, but I'm tired of waiting, so here is my cut at a near-linear randomized algorithm.

  • By choosing samples of n(1ϵ)in(1ϵ)i points, i=0,1,i=0,1,, you can get a logarithmic number of subproblems such that each sum from the original problem has constant probability of being represented uniquely in one of the subproblems (the one where the sampling cuts down the expected number of representations to near 1).
  • By repeating the sampling process a logarithmic number of times you can get all sums to have unique representations with high probability.
  • If you have a partition of AA and BB into two subsets, then by multiplying the numbers by four, adding 2 to the numbers in one of the subsets in AA, and adding 1 to the numbers in one of the subsets in BB, you can read off from the mod-4 values of the achievable sums which of the two subsets their summands come from.
  • By repeating the partition process a logarithmic number of times, using each bit position of the binary representations of the values or indices in the subproblems to select the partitions in each step, you can uniquely identify the summands of every uniquely-represented sum.

This blows up the running time by three logarithmic factors; probably that can be reduced.

David Eppstein
quelle
3
Ha ha ;). I was in the middle of writing it, and then went to lunch...
Sariel Har-Peled
5

This answer gives a determinstic O(n polylogn) algorithm.

It appears that Sariel and David's algorithm can be derandomized through an approach similar to this paper. [2] While going through the process I found there is a more general problem that implies this result.

The k-reconstruction problem

There are hidden sets S1,,Sn{1,,m}, we have two oracles Size and Sum that take a query set Q.

  1. Size(Q) returns (|S1Q|,|S2Q|,,|SnQ|), the size of each intersection.
  2. Sum(Q) returns (sS1Qs,sS2Qs,,sSnQs), the sum of elements in each intersection.

The k-reconstruction problem asks one to find n subsets S1,,Sn such that SiSi and |Si|=min(k,|Si|) for all i.

Let f be the running time of calling the oracles, and assume f=Ω(m+n), then one can find the sets in deterministic O(fklogn polylog(m)) time. [1]

Now we can reduce the finding witness problem to 1-reconstruction problem. Here S1,,S2n{1,,2n} where Si={a|a+b=i,aA,bB}.

Define the polynomials χQ(x)=iQxi, IQ(x)=iQixi

The coefficient for xi in χQχB(x) is |SiQ| and in IQχB(x) is sSiQs. Hence the oracles take O(nlogn) time per call.

This gives us an O(n polylog(n)) time deterministic algorithm.

[1] Yonatan Aumann, Moshe Lewenstein, Noa Lewenstein, Dekel Tsur: Finding witnesses by peeling. ACM Transactions on Algorithms 7(2): 24 (2011)

[2] Noga Alon, Moni Naor: Derandomization, witnesses for Boolean matrix multiplication and construction of perfect hash functions. Algorithmica 16(4-5) (1996)

Chao Xu
quelle