TIGHT BOUNDS ON THE COMPLEXITY OF RECOGNIZING ODD

0 downloads 0 Views 68KB Size Report
Jun 8, 2006 - CC] 8 Jun 2006. TIGHT BOUNDS ON THE ... Without loss of generality, we can assume that n is even because, otherwise, we can append an ...
TIGHT BOUNDS ON THE COMPLEXITY OF RECOGNIZING ODD-RANKED ELEMENTS

arXiv:cs/0606038v1 [cs.CC] 8 Jun 2006

SHRIPAD THITE

A BSTRACT. Let S = hs1 , s2 , s3 , ..., sn i be a given vector of n real numbers. The rank of z ∈ R with respect to S is defined as the number of elements si ∈ S such that si ≤ z. We consider the following decision problem: determine whether the oddnumbered elements s1 , s3 , s5 , . . . are precisely the elements of S whose rank with respect to S is odd. We prove a bound of Θ(n log n) on the number of operations required to solve this problem in the algebraic computation tree model.

Let S = hs1 , s2 , s3 , . . . , sn i ∈ Rn be a given vector. For an arbitrary real z, define the rank of z with respect to S, denoted by rankS (z), as the number of elements of S less than or equal to z. Thus, for instance, the largest element of S has rank n. Let odd(S) denote the set of elements of S whose rank with respect to S is odd. We consider the following problem: determine whether the odd-numbered elements s1 , s3 , s5 , . . . are precisely the elements of S whose rank with respect to S is odd. Without loss of generality, we can assume that n is even because, otherwise, we can append an extra element +∞ without changing the answer. Note that odd(S) has size n/2 if and only if all n values si ∈ S are distinct; hence, the answer is ‘yes’ only if S is a vector of n distinct numbers. We prove matching upper and lower bounds on the number of operations required to solve the problem in the algebraic computation tree (ACT) model (see Ben-Or [1]). The following algorithm solves the problem using O(n log n) comparisons. Sort ′ S = hs1 , s3 , s5 , . . . , sn−1 i in non-decreasing order with an optimal sorting algorithm. Similarly, sort S in non-decreasing order. Then, scan the vector S ′ and the oddnumbered elements of S to decide whether the two are equal. Next, we prove the matching lower bound. For a vector S = hs1 , s2 , s3 , . . . , sn i, let σ(S) denote the permuted vector hsσ(1) , sσ(2) , sσ(3) , . . . , sσ(n) i. We call a permutation σ, where σ(i) is odd if and only if i is odd, a permissible permutation.  2 Lemma 1. There are n2 ! permissible permutations of a vector of n elements. Proof. There are n2 ! permutations of n elements that permute the n/2 odd-numbered elements only, and n2 ! that permute the n/2 even-numbered elements only. A permissible permutation of n elements is any composition of two permutations, one that permutes the odd-numbered elements only and one that permutes the evennumbered elements only.  Observation 2. A permutation σ is permissible if and only if its inverse σ −1 is permissible. Date: May 23, 2006. 1

Let W ⊂ Rn be the set of inputs for which the answer to the question posed in the problem is ‘yes’. Recall that every point in W corresponds to a set of n distinct real numbers. Lemma 3. For an arbitrary point X ∈ W , there is a unique permutation σ that sorts X, i.e., such that xσ(1) < xσ(2) < xσ(3) < . . . < xσ(n) . Moreover, such a permutation σ is permissible. Proof. The uniqueness of the sorting permutation σ follows because every point in W corresponds to a set of distinct reals. When X is sorted, the odd-ranked elements must occupy the odd-numbered positions of the sorted vector. Since X ∈ W , the odd-ranked elements are already in odd-numbered positions of the original vector X. Therefore, the permutation σ is permissible.  Let σX denote the sorting permutation for X. Observation 4. If σX is a permissible permutation, then X ∈ W . Lemma 5. For every permissible permutation σ, there is a point X ∈ W such that σ = σX . Proof. Set X = hσ −1 (1), σ −1 (2), σ −1 (3), . . . , σ −1 (n)i. We have, σ(X) = hσ(σ −1 (1)), σ(σ −1(2)), σ(σ −1 (3)), . . . , σ(σ −1 (n))i = h1, 2, 3, . . . , ni Therefore, σ(X) is sorted, and by Lemma 3, it is the unique permutation that sorts X; hence, σ = σX . It remains to show that the point X that we chose belongs to W . The set of real numbers represented by X is {1, 2, 3, . . . , n}. Since σ is permissible, so is σ −1 by Observation 2; hence, σ −1 (i) is odd if and only if i is odd. Therefore, the ith component of the vector X is odd if and only if i is odd, which means that X ∈ W .  Lemma 6. For every two points X, Y ∈ W such that σX 6= σY , the two points X and Y lie in different connected components of W . Proof. Since X, Y ∈ W , both σX and σY are permissible permutations, by Lemma 3. For every point A = ha1 , a2 , a3 , . . . , an i ∈ W such that aσX (1) < aσX (2) < aσX (3) < . . . < aσX (n) we have σA = σX . Since σX is permissible, so is σA ; by Observation 4, this implies that A ∈ W . Additionally, A is in the same connected component of W as X because every convex combination B of A and X satisfies σB = σX . On the other hand, since σY 6= σX , there exists an i in the range 1 ≤ i ≤ n−1 such that yσX (i) ≥ yσX (i+1) . Then, X and Y cannot be in the same connected component of W because they are separated by the hyperplane yσX (i) = yσX (i+1) ; every point P on this hyperplane lies outside W because it corresponds to an input where odd(P ) has fewer than n/2 elements. We have thus shown that the region RX where RX = {ha1 , a2 , a3 , . . . , an i ∈ W : aσX (1) < aσX (2) < aσX (3) < . . . < aσX (n) } is a maximal connected component of W containing X (RX also happens to be convex); since σY 6= σX , the region RX does not contain Y .  2

Theorem 7. The set W has

n 2

 2 ! connected components.

Proof. The set W can be partitioned such that each part corresponds to a permissible permutation σ; by 2 Lemma 5, σ = σX for some X ∈ W . By Lemma 1, W is n partitioned into 2 ! parts. By Lemma 6, every two distinct permissible permutations σ and σ ′ correspond to two different connected components of W , one consisting of all points X ∈ W for which σX = σ and the other consisting of all points Y ∈ W for which σY = σ ′ .  Corollary 8. Every algebraic computation tree that decides the membership problem in W must have depth Ω(n log n). Proof. Ben-Or [1] has proved that the minimum height of an algebraic computation tree deciding membership in W is Ω(log # W ) where # W is the number of connected components of W . By Theorem 7, such a tree must have depth Ω(n log n).  Acknowledgments. Thanks to Mark de Berg, Jeff Erickson, Sariel Har-Peled, and Jan Vahrenhold for fruitful discussions. R EFERENCES [1] “Lower Bounds for Algebraic Computation Trees”. Michael Ben-Or. In Proc. ACM Symposium on Theory of Computing, pp. 80–86, 1983. Current address: Department of Mathematics and Computer Science, Technische Universiteit Eindhoven, Postbus 513, 5600 MB Eindhoven, The Netherlands; Email: [email protected]

3

Suggest Documents