PARALLEL ALGORITEMS FOR FINDING THE FL4XIPIUM. Nimrod Megiddo:k. n elements can be found by n processors in O(1) time w?'.th

Similar documents
Poly-log parallel algorithms for LP. application to exploding flying objects* Nimrod Megiddo Carnegie-Mellon University and Tel Aviv University

Dynamic location, euclidean center problem, global optimization.

b + O(n d ) where a 1, b > 1, then O(n d log n) if a = b d d ) if a < b d O(n log b a ) if a > b d

The Minimum Reservation Rate Problem in Digital. Audio/Video Systems. Abstract

ON THE DISTRIBUTION OF RESIDUALS IN FITTED PARAMETRIC MODELS. C. P. Quesenberry and Charles Quesenberry, Jr.

Divide-and-conquer: Order Statistics. Curs: Fall 2017

Lecture 4 : Quest for Structure in Counting Problems

arxiv:quant-ph/ v1 29 May 2003

Partitions and Covers

Probabilistic Analysis of a Parallel Algorithm for Finding Maximal lndependen t Sets

T U M I N S T I T U T F Ü R I N F O R M A T I K. Binary Search on Two-Dimensional Data. Riko Jacob

Yorktown Heights, New York * San Jose, California * Zurich, Switzerland

THE WEIGHTED EUCLIDEAN 1-CENTER PROBLEM*?

Quick Sort Notes , Spring 2010

CS264: Beyond Worst-Case Analysis Lecture #18: Smoothed Complexity and Pseudopolynomial-Time Algorithms

Universal Traversal Sequences for Expander Graphs

CS264: Beyond Worst-Case Analysis Lecture #15: Smoothed Complexity and Pseudopolynomial-Time Algorithms

A Nonlinear Lower Bound on Linear Search Tree Programs for Solving Knapsack Problems*

to provide continuous buered playback ofavariable-rate output schedule. The

Lecture 4: Lower Bounds (ending); Thompson Sampling

Chapter 1. Comparison-Sorting and Selecting in. Totally Monotone Matrices. totally monotone matrices can be found in [4], [5], [9],

CSE 4502/5717: Big Data Analytics

Pattern Recognition Approaches to Solving Combinatorial Problems in Free Groups

EVALUATING THE REPEATABILITY OF TWO STUDIES OF A LARGE NUMBER OF OBJECTS: MODIFIED KENDALL RANK-ORDER ASSOCIATION TEST

Sorting n Objects with a k-sorter. Richard Beigel. Dept. of Computer Science. P.O. Box 2158, Yale Station. Yale University. New Haven, CT

Random Graphs. 7.1 Introduction

Lower Bounds for Testing Bipartiteness in Dense Graphs

Cell-Probe Lower Bounds for Prefix Sums and Matching Brackets

Combining Shared Coin Algorithms

An Improved Upper Bound for SAT

COMPLEMENTARY RANDOM NUMBERS & DAGGER SAMPLING

On-line Scheduling to Minimize Max Flow Time: An Optimal Preemptive Algorithm

Lecture 8: February 8

Divide and Conquer Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 14

L 2 -induced Gains of Switched Systems and Classes of Switching Signals

Partitioning Metric Spaces

Realization Plans for Extensive Form Games without Perfect Recall

Simple Learning Algorithms for. Decision Trees and Multivariate Polynomials. xed constant bounded product distribution. is depth 3 formulas.

Succinct Data Structures for Approximating Convex Functions with Applications

The Time Complexity of Constraint Satisfaction

Generic Case Complexity and One-Way Functions

Polynomial time Prediction Strategy with almost Optimal Mistake Probability

Expectation of geometric distribution. Variance and Standard Deviation. Variance: Examples

16.1 Min-Cut as an LP

Last time, we described a pseudorandom generator that stretched its truly random input by one. If f is ( 1 2

Alternatives to competitive analysis Georgios D Amanatidis

A Deterministic Algorithm for Summarizing Asynchronous Streams over a Sliding Window

Nader H. Bshouty Lisa Higham Jolanta Warpechowska-Gruca. Canada. (

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan 1/29/2002. Notes for Lecture 3

A Gentle Introduction to Gradient Boosting. Cheng Li College of Computer and Information Science Northeastern University

Notes on Computer Theory Last updated: November, Circuits

Containment restrictions

Some Sieving Algorithms for Lattice Problems

On the correlation of parity and small-depth circuits

Fast Sorting and Selection. A Lower Bound for Worst Case

5. DIVIDE AND CONQUER I

arxiv: v2 [cs.ds] 28 Jan 2009

Expectation of geometric distribution

w = X ^ = ^ ^, (i*i < ix

Lecture 2: Convergence of Random Variables

About complexity. Number theoretical algorithms

STATISTICS/ECONOMETRICS PREP COURSE PROF. MASSIMO GUIDOLIN

CSE 421, Spring 2017, W.L.Ruzzo. 8. Average-Case Analysis of Algorithms + Randomized Algorithms

8 Basics of Hypothesis Testing

Approximating min-max (regret) versions of some polynomial problems

SUFFICIENT STATISTICS

3.1 Asymptotic notation

Irredundant Families of Subcubes

Probability Distributions Columns (a) through (d)

Sampling Contingency Tables

NOTES ON HIGHER-DIMENSIONAL TARAI FUNCTIONS. 0. Introduction I. Takeuchi defined the following recursive function, called the tarai function,

Lecture 3. The Population Variance. The population variance, denoted σ 2, is the sum. of the squared deviations about the population

Decision Trees: Overfitting

Approximation algorithms based on LP relaxation

Optimal Resilience Asynchronous Approximate Agreement

5 ProbabilisticAnalysisandRandomized Algorithms

Lecture 2: Streaming Algorithms

Now just show p k+1 small vs opt. Some machine gets k=m jobs of size at least p k+1 Can also think of it as a family of (1 + )-approximation algorithm

Being Taught can be Faster than Asking Questions

On the complexity of approximate multivariate integration

Uncertainty. Jayakrishnan Unnikrishnan. CSL June PhD Defense ECE Department

COL 730: Parallel Programming

5. DIVIDE AND CONQUER I

Limits Involving Infinity (Horizontal and Vertical Asymptotes Revisited)

The Size and Depth of Layered Boolean Circuits

COMP 355 Advanced Algorithms

A Duality between Clause Width and Clause Density for SAT

ON TESTING HAMILTONICITY OF GRAPHS. Alexander Barvinok. July 15, 2014

Questions Pool. Amnon Ta-Shma and Dean Doron. January 2, Make sure you know how to solve. Do not submit.

Discrete Newton s Algorithm for Parametric Submodular Function Minimization

COM BIN ATOR 1 A L MATHEMATICS YEA R

Mean-Payoff Games and the Max-Atom Problem

Introduction to Machine Learning CMU-10701

Lecture 3: Lower Bounds for Bandit Algorithms

CSCE 222 Discrete Structures for Computing. Review for Exam 2. Dr. Hyunyoung Lee !!!

The concentration of the chromatic number of random graphs

6.896 Quantum Complexity Theory November 4th, Lecture 18

Towards Optimal Multiple Selection

On stars and Steiner stars. II

An Improved Approximation Algorithm for Requirement Cut

Transcription:

PARALLEL ALGORITEMS FOR FINDING THE FL4XIPIUM AND THE MEDIAN ALMOST SURELY I N CONSTANT-TIME Nimrod Megiddo:k Abstract. It is shown that the maximum and the median of a set of n elements can be found by n processors in O(1) time w?'.th probability approaching 1 as n tends to infinity. The naximum- finding algorithm runs on the WRAM model whereas the median-finding algorithm is in the parallel computation tree model. These models are of course strong but, as we have shown in a previous paper, are very useful for designing good serial algorithms based on parallel ones. Our parallel probabilistic algorithms in this paper yield interesting serial probabilistic algorithms. Warnegie-Mellon University, GSIA, Pitt~bur&)~, PA 15213

1. Introduction We will discuss here probabilistic algorithms that make no errors, i.e., algorithms which involve random moves and yet always terminate with the correct outcome. The time-complexity is measured by the expected time that it takes to solve the worst-case instance. Thus, the expectation is defined relative to the internal randomization of the algorithm. In fact, for the algorithms presented here we can make stronger claims regarding the (random) running time in the worst-case. The format will be the following: The probability p(n) that the algorithm terminates within t(n) time units tends to 1 as n approaches infinity. Moreover, t (n) will be constant! To our knowledge, there is no good example in serial computation where the option of randomization leads to a significantly better time bound, given that the correct outcome should always be produced. It is thus interesting to find that randomization is very helpful in parallel computation. This is demonstrated in two cases: Finding the maximum and the median. Our main motivation comes from [Ml] where we showed how to use good parallel algorithms in the design of serial algorithms. Here we introduce a new feature which lets us produce interesting probabilistic algorithms from parallel probabilistic ones. Applications of the results of this paper are given in a companion paper [M2] where a dynzmic computational geometric problem is solved with the aid of our algorithm for the maximum. An application along the same lines was also given by Zemel [Z]. Our first example is of finding the maximum. It has neen proved by L. Valiant [V] that loglog n comparisons are required for n processors In order to find the maximum in a set of n elements. Valiant also gave an O(log1og n) algorithm in the strong model of comparisons (later called the parallel computation tree [BH]), which was later extended by Shiloach and

Vishkin [SV] to a weaker model. It is interesting to note that the exact maxi- mum can be found by a randoinizing algorithm in expected O(1) time on n processors, in the latter model. The second example deals with the general selection problem. An open question in parallel computation is whether selection is substantially easier than sorting. The question was raised by Valiant [V] in the context of the parallel computation tree model. It is not known how to deterministically sort a set of n elements on n processors in O(1og n) time. On the other hand an expected number of Q(log n) comparisons is required for sorting on n processors. Surprisingly, it is possible to exactly solve the selection prob- lem in O(1) expected time in the parallel computation tree model. So, this is another case where randomization helps significantly. 2. Finding the Maximum We first let each of Fn processors sample an element of the set. Since this is done in parallel, some of the processors may sanple the same elements so this is like "sampling with replacement." The expected number of distinct elements in the sample is rn - own). In the next step we find the maximum of the sample, deterministically in constant-time, by comparing every pair of sample elements. The details of the implementation of this step in the WRAM model (requiring concurrent reads and writes) are in [SV]. Given the sample-maximum, we now compare each element of the set with this maximum and "discard" the ones that are smaller. This is done in constant- time (subject to concurrent read). If the number of the remaining elements is smaller than then it takes one step of comparisons to find the maximum.

(See [SV] for the implementation). Otherwise, we again sample fi elements, determine their maximum, and so on. We will now prove that the probability, that we will be done after two sampling steps, is approaching 1 when n tends to infinity. Let X 1, X be independent random variables uniformly distributed over s [O,l'j, where s = LC]. Let Yi = lnxil (i = 1,..., s) so that Y. represents the 1 rank of the element sampled by Xi. Let X(l) <... < X denote the order - (s) statistics of {xl,..., Xs] and let Y(l) j... < V be the order statistics - (s). It i s well-known (see [W, p. 2361 ) that X has the densiry (s) s-1 S S function f(x) = sx so that its mean is - arid its variance is s+l Asymptotically, the mean of Y is hence n - fi and its standard 2 (s+l) (s+2) (s I I deviation is n. Thus, the probability that Y > n-n 1/2+ (s) approaches 1 for every s > 0. Equivalently, the number of remaining elements 1 I after the first step is o(n 112+E), with probability approaching 1, for every E > 0. Now, consider the second step. Using the same notation, let now = ln1'2+ee~.1. Thus Yi is the rank of the element sampled by (during 'i 1 I 1/2+ the second step), relative to the remaining set, assuming this set has n I elements. Now the mean of Y is asymptotically equal to (s) Thus the mean of th2 number of elements remaining after the second step is E asymptotically n. Obviously, the actual number is less than n1/2, with probability approaching 1.

3. Finding the Median The algorithm for the median is in the parallel computation tree model, i.e., we count only comparisons as time consuming operations. The algorithm is related to that of [FR] for serial selection. Like in the case of the maximum, we start by sampling elements. Next, we select from the sample two elements, namely, the ones whose ranks 1 6 relative to the sample are - fi 2 n, where s > 0 is a number to be determined 2 later. Now, given the two elements, it takes two rounds of comparisons to find their ranks relative to the input set, merely by comparing them with every element. Then, it can be decided which elements may be discarded and what is the rank of the median relative to the remainder of the set. The remainder consists of the elements that lie between the two we have selected, with probability approaching 1. Asstme that we are left with m elements, and we need to find our median, which has a rank of r relative to the remainder. If m < fi then we can terminate in one step of comparisons. Otherwise, we again sample fi elements from the remainder and select the ones whose ranks, relative to the sample, are r 8 --'\mine The process continues in this way until we are left with less m than ]G elements. We will now prove that the probability, that we will be done after three sampling steps, is approaching 1 1 1 Z < C < T ' when n tends to infinity, provided Let Xi, Yi, X(i) and Y be as above. The variable X has the (i> (k) k beta distribution B(k, s-k+l) [W, p. 2361. As such, its mean equals - s-tl while its variance is equal to k(s-k+l) (see [w, p. 1741 ). 1f s = \r;; (S-kl) (s+2)

E and k = a, fi - n, then the mean implies that the expected rank of is did= e-112 1 a - n + 0(-). This fi+l fi the element sampled by X ( k) (i. e., the mean of Y(k)) is a n - n 1/2+e + 0Tn). Similarly, the variance of X is equal to (k) E (a n-n ) c n - a \~;;+n%l) a(l-a) hl 6+1) 0~i;+2) 6 Thus, the standard deviation of X (k) is asymptotically equal to dcu(1 - ~)-II'~'~, so that the standard deviation of = n 3. 1 4, Y (k) is asymptotically It thus follows that if c > - then the probability, that 6 Y is less than m, is approaching 1. Analogously, for R = (k) + n, the probability that (1.) is greater than an is approaching 1. It thus follows that, with probability approaching 1, the (cyn)-th order statistic of the set is between the elements sampled by X (k) and X (A) ' We will now consider the number of remaining elements, given that t:e are left with the middle range. Consider the difference X - X (4) (k)' the beta distribution (see [W, p. 2381 ) This random variable also has $(R - k, s - R + k + 1). a-k s+13 Its mean equals - which in our case is Z"e -- 2n '-'I2. v%+1 The corresponding number of input elements is asymptotically 2n 112+r. The variance of X - X (R) (k) is equal to -1/2+ /2 so The standard deviation of X - X is asymptotically p.n (4) (n) that the standard deviation of the corresponding number of elements is

asymptotically fl n 112+c12. Thus, with probability approaching 1, the number of remaining elements after the first sampling step is ~(n~/~-"). The second sampling step will leave us (with probability approaching 1) with only 2 2n e-1'2-~(n1/2+c) = O(n ) elements. Recall that this holds for E > x. Now, a third sampling stop will leave us (with probability approaching 1) with e-1/2 2e 3e-112 1 1 *O(n ) = O(n 2n ) elements.- Thus, if - 4 < e < 7, the third step will leave us with less than V% elements, with probability approaching 1. In other words, we will almost surely not need more than three sampling steps. 4. Conclusion The main difference between the two algorithms is due to the fact that the maximum is of course always not smaller than the sample-maximum whereas the position of the median relative to the sample-median is not known in advance, and requires counting the number of "winners" in a round of comparisons. This is essentially why we cannot run our median-finding algorithm in O(1) time in other models. However, the power of randomization in parallel computa- tion is surprising and the potential with respect to probabilistic serial algori thrns is very promising. Discussions with IJ. F. Eddy, L. Rudolph and U. Vlshkin are gratefully acknowledged. References [BH] A. Borodin and J. E. Hopcroft, "Routing, Mergcng and Sorting on Parallel Models of Computation,'' Proceedings of the 14th Annual A& Symposium on Theory of Computing (1982) 338-344. [FR] R. W. Floyd and R. L. Rivest, "Expected Time Bounds for Selection," Communications of the ACM 18 (1975) 165-172.

[MI] N. Megiddo, "Applying Parallel Computation Algorithms in the Design of Serial Algorithms," Proceedings of the 22nd IEEE Symposium on Foundations of Computer Science (l98l), 399-408. [MZ] N. Megiddo, "Poly-log Parallel Algorithms for LP with an Application to Exploding Flying Objects," preliminary report, November 1982. [SV] Y. Shiloach and U. Vishkin, "Finding the Maximum, Merging and Sorting in a Parallel Computation Model," J. Algorithms 2 (1981) 88-102. [V] L. G. Valiant, "Parallelism in Comparison Problems," SIAM J. Comput. 4 (1975) 348-355. [W] S. M. Wilks, Mathematical Statistics, JohnWiley& Sons, New York, 1962. [Z] E. Zemel, "Randomized Parallel Algorithms for Selection with Applications," Working paper, November 1982.