Sorting and Selection on a Linear Array with Optical Bus System
|
|
- Elijah Watts
- 6 years ago
- Views:
Transcription
1 Sorting and Selection on a Linear Array with Optical Bus System Hossam ElGindy Dept. of Elec. & Compt. Eng. Uni. of Newcastle, Australia Sanguthevar Rajasekaran Dept. of CISE Univ. of Florida Abstract In this paper we present randomized algorithms for selection and sorting on linear arrays with optical bus communication systems. We show that sorting n given numbers can be performed in O(log n) time with high probability on a linear array, of n processors, with a reconfigurable optical bus system (Linear- AROB). We also show that selection can be performed in O(1) time with high probability on the same parallel machine model. 1 Introduction Several models of parallel computing based on optical technology have been recently proposed, since the large bandwidth of optical buses has the potential to speedup parallel computations. Examples include the Optical Communication Parallel Computer (OCPC) (see e.g., [5]), Array withreconfigurable Optical Buses (AROB) (see e.g., [11]), and the Optical Transpose Interconnection System (OTIS) (see e.g., [8]). This work is supported in part by an NSF Award CCR and an EPA Grant R
2 Fundamental problems suchas packet routing, sorting, and selection have been studied on these models. The model used in this paper is the linear version of the AROB model. A basic unit of computing in this model is called a cycle. A cycle consists of n slots, one for each processor in the array. A slot refers to the time taken by a message to traverse the length of the optical bus between two neighboring processors in the array. A cycle is the time taken by a message to traverse from processor 1 to processor n. It has been argued that for reasonably sized arrays the duration of a cycle is comparable to the time needed for a basic CPU operation and hence is assumed to be a constant [11]. Given a sequence of n numbers, the problem of sorting is to rearrange this sequence in ascending order. This problem has been extensively studied owing to its fundamental nature and importance. Several optimal algorithms have been devised in sequence (see e.g., [7]) and in parallel (see e.g., [13]). Sorting has also been studied on the optical models [15, 6, 12, 10, 2, 3]. Sorting algorithms on 2D AROBs have been given in [15, 6]. For example, the deterministic algorithm of [15] sorts n numbers on an n n ɛ 2D-AROB in O(1) time, where ɛ is any constant > 0. On the Linear-AROB, integer sorting algorithms are considered in [15, 12]. Pan et al [10] presented an algorithm with O(log n) expected time, and O(n) worst case time, for general sorting on the Linear-AROB model. More recently ElGindy presented an algorithm with O(log 2 n) worst case running time on the related LAPOB model 1 [2], which was later modified to obtain an algorithm with an O(log n log log n) worst case time on the LAPOB [3]. In this paper we present a randomized sorting algorithm for the Linear-AROB with a run time of O(log n) with high probability. By high probability we mean a probability of (1 n α ), for any fixed α 1. We say a randomized algorithm uses Õ(f(n)) amount of any resource (like time, space, etc.) if the amount of resource used is no more than cαf(n) with probability (1 n α )forsomeconstantc. Similar definitions apply to Θ(.), Ω(.). We also present a randomized selection algorithm that runs in Õ(1) time. In contrast, the selection algorithm of Pan [9] runs in an expected O(log n) time. Inthe worst case this algorithm could take Ω(n) time. AnÕ(1) time selection algorithm 1 Linear Array with Pipelined Bus LAPOB is a basic optical bus model where programmable delay and reconfigurable switches are not permitted. 2
3 has been given in [15] for the 2D-AROB. 2 Preliminaries In this section we mention some properties of the Linear-AROB that will be used subsequently. Let L denote a Linear-AROB with n processors. Problem 1. There is at most one packet originating from any node and at most one packet destined for any node. The problem is to route the packets. Lemma 2.1 Problem 1 can be solved in O(1) cycles on L. Proof: Each processor chooses its writing slot depending on the destination of its packet. Details can be found in [11, 15]. Problem 2. There is a bit at each node. The problem is to compute the prefix sum values of these bits. Lemma 2.2 Problem 2 can be solved in O(1) cycles in L [11]. Proof: One of the properties of the Linear-AROB is that the processors can introduce a delay of one slot in any signal passing through them. Let processor 1 initiate a signal at the beginning of a cycle. Any processor that has a one introduces a delay of one slot. Processors withzeros do not delay the signal. A processor can determine its prefix sum value by noting the time the signal reaches it. Problem 3. There is a bit at each node of L. let l be any integer suchthat 1 l n. Without loss of generality assume that l divides n. The problem is to compute segmented prefix sums where each set of consecutive l processors forms a segment. Lemma 2.3 Problem 3 can be solved in O(1) cycles on L. 3
4 Proof: The proof is similar to that of Lemma 2.2. The only difference is that the first processor of eachsegment is now going to initiate a signal. The following Lemmas are stated without proofs and are from [3]. Lemma 2.4 A processor can broadcast a value to a contiguous set (of any size) of processors. Lemma 2.5 Let q 1,q 2,...,q k any set of k processors. Also let S 1,S 2,...,S k be disjoint sets of contiguous processors that preserve the order of the k processors. Then, q i can broadcast to S i,fori =1, 2,...,k, in a single cycle. Lemma 2.6 Let q 1,q 2,...,q k any set of k processors. Also let S 1,S 2,...,S k be disjoint sets of processors. For any S i (1 i k), the processors in S i are at equal intervals. Then, q i can be broadcast to S i,fori =1, 2,...,k, in a single cycle. 3 A Logarithmic Time Sorting Algorithm In this section we present an Õ(log n)-cycle algorithm for sorting n elements on L. Before presenting the algorithm, we show that sorting can be done in O(1) cycles in the worst case on L provided there are only n elements. Let the elements to be sorted be k 1,k 2,...,k n and let them be in the processors 1, 2,..., n. Th is algorithm is similar to the merging algorithm given in [3]. Let S 1 be the set of the first n processors of L, S 2 be the next n processors of L, andsoon. AlsoletS 1 be the set of processors consisting of 1, n +1, 2 n +1,..., S 2 be the set consisting of 2, n +2, 2 n +2,..., etc. There are four steps in the algorithm. Step 1. Broadcast k 1 to S 1, k 2 to S 2, and so on. These broadcasts can be done in O(1) cycles (c.f. Lemma 2.6). At the end of this, each set S i (for 1 i n)hasa copy of the input sequence. Step 2. Broadcast k 1 to S 1, k 2 to S 2, and so on. This takes O(1) cycles (c.f. Lemma 2.5). Processors in S 1 compare k 1 withevery input key; processors in S 2 compare k 2 withevery input key; etc. 4
5 Step 3. Perform a segmented prefix sums computation (c.f. Problem 3) with l = n so that the rank of each input key can be computed. Step 4. Route the key whose rank is i to processor i, for1 i n. Th is takes O(1) cycles in accordance withlemma 2.1. The correctness of this algorithm is quite clear. Thus we get the following Theorem. Theorem 3.1 We can sort n keys in O(1) cycles on L. Now we are ready to describe our randomized algorithm. The technique of sampling has dominated the design of both sequential and parallel sorting algorithms in the past two decades. A popular technique is one that was introduced by Frazer and McKellar [4]. The idea is to pick a random sample S of s keys from the input, sort this input, partition the input using the sorted sample keys as splitter keys, and sort the resultant parts independently. This approach has been used over a variety of parallel models. The following sampling lemma from [14] will be useful in the analysis of our algorithm. Let S = {k 1,k 2,...,k s } be a random sample from a set Y of cardinality N. Let select(y,i) stand for the ithsmallest element of Y for any integer i. Alsolet k 1,k 2,...,k s be the sorted order of the sample S. If r i is the rank of k i in Y and if S = s, the following lemma [14] provides a high probability confidence interval for r i. Lemma 3.1 For every α>0, Prob. ( r i i N > ) 3α N s s log N <N α. Our algorithm differs from that of Frazer and McKellar s. We still use random sampling. Whereas Frazer and McKellar s algorithm partitions the input using s splitter keys (where s is typically chosen to be Ω( n)), we partition the input using a single splitter key. Also, Frazer and McKellar s algorithm randomly chooses the s splitter keys. In contrast we choose a random sample and use the median of this sample as the splitter key. In particular, we pick a random sample S of size Θ(n 1/4 ), sort this sample using Theorem 3.1 and as a result find the median M of this sample, partition the input around this median, and recursively sort the resultant parts in parallel. At any given 5
6 time the array will consist of subproblems where a subproblem will be that of sorting keys in a contiguous set of processors. To begin withthere will be only one subproblem (of size n). Consider any subproblem that spans processors i through j. LetN =(j i +1). The following algorithm is executed for each such subproblem in parallel. repeat Algorithm Sort Step 1. Eachprocessor decides to include its key in the sample S with 1 probability. The expected number of sample keys is N 1/4. Using N 3/4 Chernoff bounds [1] we can show that the number of keys in S is Θ(N 1/4 ). (Here the underlying probability is (1 N α ).) Step 2. Using a prefix computation count the number s of keys in S. Also using Lemma 2.1 compact the sample keys in the first s processors. Step 3. Sort the sample keys using Theorem 3.1. Thus find and broadcast the median M of the sample keys. Step 4. Let N 1 be the number of keys in the subproblem that are less than or equal to M and let N 2 be the number of keys greater than M. Rearrange the keys so that all the keys that are less than or equal to M will appear first followed by all the keys that are greater than M. Th e subproblem has thus been replaced with two new subproblems, one from i to i + N 1 1 and the other from i + N 1 to j. until the maximum size of any subproblem is O(1); Sort the subproblems. Theorem 3.2 Algorithm Sort runs in Õ(log n) cycles. 6
7 Proof: The main idea behind the proof is to show that the size of any subproblem reduces by a factor of nearly two in one iteration of the repeat loop (withhigh probability) and that each iteration of the repeat loop only takes O(1) cycles. Step 1 takes O(1) time. Step 2 involves a prefix computation and a partial permutation routing. Thus Step 2 takes O(1) cycles (c.f. Lemmas 2.2 and 2.1). Step 3 involves sparse enumeration sorting and hence can be completed in O(1) cycles (in accordance withtheorem 3.1). In Step 4, we can count N 1 using Lemma 2.2 in O(1) cycles. As a byproduct we can also compute a unique address for each key in order to perform the compaction step. Routing can be done using Lemma 2.1. Therefore, Step 4 also takes O(1) cycles. We can check if the maximum size of any subproblem is O(1) or not using a prefix computation as follows. Let a subproblem span the processors i through j. Forma sequence in which the (i + 1)ththroughthe jthelements are zeros. The ithelement is one if the size of this subproblem is greater than some constant and zero otherwise. Perform a prefix computation in the whole array to count the number of subproblems that are greater than a constant. Once the repeat loop terminates it is easy to sort the sub-problems in O(1) time. In summary, eachiteration of the repeat loop can be completed in O(1) cycles. It remains to be shown that there will only be Õ(log n) iterations of the repeat loop. Consider any subproblem X of size N. Each element is chosen to be in the sample 1 S withprobability. Thus the expected number of sample keys is N 1/4. Using N 3/4 Chernoff bounds, this number is seen to be s = Θ(N 1/4 ). The median M of S is expected to be an approximate median of the subproblem. Using the sampling Lemma 3.1 we see that the rank of M in X can differ from N by 2 at most 3.5α N s log N = O(N 0.9 ). In other words, M is a very close approximation to the median of X. Thus a given subproblem gets split into two subproblems in an iteration of the repeat loop suchthat eachsuchnew subproblem is of size no more than 0.6N with probability (1 N α ). As a consequence it follows that the number of iterations of the repeat loop is Õ(log n). Note that this expectation is over the space of all possible outcomes for the coin flips made in the algorithm (and not over the space of all possible inputs). 7
8 Since the probability of our assertion decreases with iteration, it s not clear if the number of iterations will be O(log n) withprobability (1 n α ). There are a number of ways in which we can indeed show that the number of iterations is only O(log n) withprobability (1 n α ). One way is to employ the process tree defined in [16]. We omit the details. 4 A Constant Time Selection Algorithm Selection is an important comparison problem that has numerous applications. Selection takes as input a sequence of n keysandanintegeri, 1 i n. The goal is to identify the ithsmallest of the n input keys. Several linear time algorithms are known for sequential selection (see e.g., [7]), and optimal algorithms have also been devised on various parallel models (see e.g., [13]). In this section we show that selection from n keys can be performed in Õ(1) cycles on an n-node Linear-AROB. The idea is to make use of sampling as follows: 1. Choose a random sample S of size q = o(n) 2. Identify two elements l 1 and l 2 from the sample whose ranks in S are i q δ and n i q + δ for some appropriate δ. It can be shown that these elements bracket n the element to be selected with high probability; 3. Eliminate all keys whose values are outside the range [l 1,l 2 ]; 4. Perform an appropriate selection from out of the remaining keys. In the case of Linear-AROB, the above idea can be implemented as follows. The algorithm starts with the number of alive keys N being the same as n and progresses in stages, where each stage proceeds as follows: 1. If N n, compact the alive keys, sort them using Theorem 3.1, and output the ithsmallest key. 2. Eachprocessor decides to include its key in the sample S withprobability 1 N 3/4. The number of keys in S is Θ(N 1/4 ). 8
9 3. Compact and sort the sample keys using Theorem 3.1. Let l 1 and l 2 be the keys from S withranks i S N d S log N and i S N + d S log N, respectively, d being a constant > 3α. We can show that l 1 and l 2 will bracket the ith smallest element withhighprobability. 4. Now kill the alive keys whose values are not in the interval [l 1,l 2 ]. Let N be the number of surviving keys. Let N 1 be the number of keys that got killed with a value <l If the key to be selected does not have a value in the interval [l 1,l 2 ]redothis stage else set i = i N 1 and proceed to the next stage. It is easy to see that each step in a stage can be performed in O(1) cycles and hence a stage itself takes only O(1) cycles. Also we can show using Lemma 3.1 that if N is the number of alive keys at the beginning of any stage, then the number of alive keys at the end of the stage is Õ(N 0.9 ). This in turn means that there can only be Õ(1) stages in the algorithm. Thus we get the following Theorem. Theorem 4.1 We can perform selection from out of n keys in n-node Linear-AROB. Õ(1) cycles on an 5 Conclusions In this paper we have presented an Õ(log n) cycles algorithm to sort n given numbers on an n-node Linear-AROB. It is still an open problem to matchthese bounds using a deterministic algorithm. We have also presented an Õ(1) cycles selection algorithm for the Linear-AROB model. 9
10 References [1] H. Chernoff, A Measure of Asymptotic Efficiency for Tests of a Hypothesis Based on the Sum of Observations, Annals of Mathematical Statistics 23, 1952, pp [2] H. ElGindy, Sorting on Linear Arrays withoptical Buses, Manuscript, February [3] H. ElGindy, An Improved Sorting Algorithm for Linear Arrays with Optical Buses, submitted for publication, April [4] W.D. Frazer and A.C. McKellar, Samplesort: A Sampling Approachto Minimal Storage Tree Sorting, Journal of the ACM 17(3), 1970, pp [5] L. Goldberg, M. Jerrum, T. Leighton, and S. Rao, A Doubly-Logarithmic Communication Algorithm for the Completely Connected Optical Communication Parallel Computer, Proc. Symposium on Parallel Algorithms and Architectures, 1993, pp [6] Z. Guo, Sorting on Array Processors withpipelined Buses, Proc. International Conference on Parallel Processing, Volume III, 1992, pp [7] E. Horowitz, S. Sahni, and S. Rajasekaran, Computer Algorithms, W.H.Freeman Press, [8] G. C. Marsden, P. J. Marchand, P. Harvey, and S. C. Esener, Optical Transpose Interconnection System Architectures, Optic Letters, 18(3): , July [9] Y. Pan, Order statistics on optically interconnected multiprocessor system, The First International Workshop on Massively Parallel Processing Using Optical Interconnections, Cancun, Mexico, pp , April [10] Y. Pan and M. Hamdi, Quicksort on a linear array witha reconfigurable pipelined bus system, The IEEE International Symposium on Parallel Architectures, Algorithms, and Networks, Beijing, China, June
11 [11] S. Pavel and S. Akl, On the Power of Arrays with Optical Pipelined Buses, Proc. International Conference on Parallel and Distributed Processing Techniques and Applications, Vol. III, 1996, pp [12] S. Pavel and S. Akl, Integer Sorting and Routing in Arrays withreconfigurable Optical Buses, Proc. International Conference on Parallel Processing, [13] S. Rajasekaran, Sorting and Selection on Interconnection Networks, DIMACS Series in Discrete Mathematics and Theoretical Computer Science 21, 1995, pp [14] S. Rajasekaran and J.H. Reif, Derivation of Randomized Algorithms for Sorting and Selection, in Parallel Algorithm Derivation And Program Transformation, edited by R. Paige, J.H. Reif, and R. Wachter, Kluwer Academic Publishers, [15] S. Rajasekaran and S. Sahni, Sorting, Selection, and Routing on the Array with Reconfigurable Optical Buses, IEEE Transactions on Parallel and Distributed Systems 8(1), 1997, pp [16] S. Rajasekaran and S. Sen, Random Sampling Techniques and Parallel Algorithms Design, in Synthesis of Parallel Algorithms, editedbyj.h.reif,morgan- Kaufmann Publishers,
Randomized Sorting on the POPS Network
Randomized Sorting on the POPS Network Jaime Davila and Sanguthevar Rajasekaran July 29, 2004 Abstract Partitioned Optical Passive Stars (POPS) network has been presented recently as a desirable model
More informationRandomized Routing, Selection, and Sorting on the OTIS-Mesh
Randomized Routing, Selection, and Sorting on the OTIS-Mesh Sanguthevar Rajasekaran and Sartaj Sahni Dept. of CISE, Uniersity of Florida Gainesville FL 3611 Abstract The Optical Transpose Interconnection
More informationA COMPARISON OF MESHES WITH STATIC BUSES AND HALF-DUPLEX WRAP-AROUNDS. and. and
Parallel Processing Letters c World Scientific Publishing Company A COMPARISON OF MESHES WITH STATIC BUSES AND HALF-DUPLEX WRAP-AROUNDS DANNY KRIZANC Department of Computer Science, University of Rochester
More informationAbstract. 1 Introduction
Designing Efficient Distributed Algorithms Using Sampling Techniques S. Rajasekaran and D.S.L. Wei University of Florida and University of Aizu Abstract In this paper we show the power of sampling techniques
More informationOptimal Parallel Randomized Renaming
Optimal Parallel Randomized Renaming Martin Farach S. Muthukrishnan September 11, 1995 Abstract We consider the Renaming Problem, a basic processing step in string algorithms, for which we give a simultaneously
More informationPermutation Routing and Sorting on the Reconfigurable Mesh
Permutation Routing and Sorting on the Reconfigurable Mesh Sanguthevar Rajasekaran Theodore McKendall Department of Computer and Information Science Univ. of Florida, Gainesville, FL 32611. Abstract In
More informationRandomized Parallel Selection
University of Pennsylvania ScholarlyCommons Technical Reports (CIS) Department of Computer & Information Science November 1990 Randomized Parallel Selection Sanguthevar Rajasekaran University of Pennsylvania
More informationDerivation of Randomized Sorting and Selection Algorithms
Derivation of Randomized Sorting and Selection Algorithms Sanguthevar Rajasekaran Dept. of CIS, University of Pennsylvania, raj@central.cis.upenn.edu John H. Reif Dept. of Computer Science, Duke University,
More informationA Comparison of Meshes With Static Buses and Unidirectional Wrap-Arounds
University of Pennsylvania ScholarlyCommons Technical Reports (CIS) Department of Computer & Information Science July 1992 A Comparison of Meshes With Static Buses and Unidirectional Wrap-Arounds Danny
More informationRandomized Algorithms: Selection
Randomized Algorithms: Selection CSE21 Winter 2017, Day 25 (B00), Day 16 (A00) March 15, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Selection Problem: WHAT Given list of distinct integers a 1, a 2,,
More informationEmulation of a PRAM on Leveled Networks
Emulation of a PRAM on Leveled Networks Michael Palis 1, Sanguthevar Rajasekaran 1,DavidS.L.Wei 2 ABSTRACT There is an interesting class of ICNs, which includes the star graph and the n-way shuffle, for
More informationSORTING AND SELECTION ON INTERCONNECTION NETWORKS. 1 Introduction SANGUTHEVAR RAJASEKARAN
SORTING AND SELECTION ON INTERCONNECTION NETWORKS SANGUTHEVAR RAJASEKARAN ABSTRACT. In this paper we identify techniques that have been employed in the design of sorting and selection algorithms for various
More informationAlgorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48
Algorithm Analysis (Algorithm Analysis ) Data Structures and Programming Spring 2018 1 / 48 What is an Algorithm? An algorithm is a clearly specified set of instructions to be followed to solve a problem
More information1 (15 points) LexicoSort
CS161 Homework 2 Due: 22 April 2016, 12 noon Submit on Gradescope Handed out: 15 April 2016 Instructions: Please answer the following questions to the best of your ability. If you are asked to show your
More informationSORTING AND SELECTION
2 < > 1 4 8 6 = 9 CHAPTER 12 SORTING AND SELECTION ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN JAVA, GOODRICH, TAMASSIA AND GOLDWASSER (WILEY 2016)
More informationLecture 3: Sorting 1
Lecture 3: Sorting 1 Sorting Arranging an unordered collection of elements into monotonically increasing (or decreasing) order. S = a sequence of n elements in arbitrary order After sorting:
More informationSORTING AND SELECTION ON PARALLEL DISK MODELS
Chapter 1 SORTING AND SELECTION ON PARALLEL DISK MODELS Sanguthevar Rajasekaran Department of CISE, Univ. of Florida raj@cise.ufl.edu Abstract Data explosion is an increasingly prevalent problem in every
More informationParallel Solutions of the Longest Increasing Subsequence Problem Using Pipelined Optical Bus Systems
Parallel Solutions of the Longest Increasing Subsequence Problem Using Pipelined Optical Bus Systems David SEME and Sidney YOULOU LaRIA, Université de Picardie Jules Verne, CURI, 5, rue du Moulin Neuf,
More informationAlgorithms and Applications
Algorithms and Applications 1 Areas done in textbook: Sorting Algorithms Numerical Algorithms Image Processing Searching and Optimization 2 Chapter 10 Sorting Algorithms - rearranging a list of numbers
More informationRandomized Selection on the Hypercube 1
Randomized Selection on the Hyercube 1 Sanguthevar Rajasekaran Det. of Com. and Info. Science and Engg. University of Florida Gainesville, FL 32611 ABSTRACT In this aer we resent randomized algorithms
More informationParallel Systems Course: Chapter VIII. Sorting Algorithms. Kumar Chapter 9. Jan Lemeire ETRO Dept. November Parallel Sorting
Parallel Systems Course: Chapter VIII Sorting Algorithms Kumar Chapter 9 Jan Lemeire ETRO Dept. November 2014 Overview 1. Parallel sort distributed memory 2. Parallel sort shared memory 3. Sorting Networks
More informationConstant Queue Routing on a Mesh
Constant Queue Routing on a Mesh Sanguthevar Rajasekaran Richard Overholt Dept. of Computer and Information Science Univ. of Pennsylvania, Philadelphia, PA 19104 ABSTRACT Packet routing is an important
More informationParallel Systems Course: Chapter VIII. Sorting Algorithms. Kumar Chapter 9. Jan Lemeire ETRO Dept. Fall Parallel Sorting
Parallel Systems Course: Chapter VIII Sorting Algorithms Kumar Chapter 9 Jan Lemeire ETRO Dept. Fall 2017 Overview 1. Parallel sort distributed memory 2. Parallel sort shared memory 3. Sorting Networks
More informationA Parallel Algorithm for Relational Coarsest Partition Problems and Its Implementation
A Parallel Algorithm for Relational Coarsest Partition Problems and Its Implementation Insup Lee and S. Rajasekaran Department of Computer and Information Science University of Pennsylvania Philadelphia,
More informationBASIC ALGORITHMS ON PARALLEL OPTICAL MODELS OF COMPUTING
BAIC ALGORITHM O PARALLL OPTICAL MODL OF COMPUTIG AGUTHVAR RAJAKARA Abstract. In this paper we identify some of the optical models of computing that have been proposed and survey algorithms for fundamental
More informationProblem. Input: An array A = (A[1],..., A[n]) with length n. Output: a permutation A of A, that is sorted: A [i] A [j] for all. 1 i j n.
Problem 5. Sorting Simple Sorting, Quicksort, Mergesort Input: An array A = (A[1],..., A[n]) with length n. Output: a permutation A of A, that is sorted: A [i] A [j] for all 1 i j n. 98 99 Selection Sort
More informationCPSC 536N: Randomized Algorithms Term 2. Lecture 4
CPSC 536N: Randomized Algorithms 2011-12 Term 2 Prof. Nick Harvey Lecture 4 University of British Columbia In today s lecture we will see two applications of negative binomially distributed random variables.
More informationParallel Algorithms for (PRAM) Computers & Some Parallel Algorithms. Reference : Horowitz, Sahni and Rajasekaran, Computer Algorithms
Parallel Algorithms for (PRAM) Computers & Some Parallel Algorithms Reference : Horowitz, Sahni and Rajasekaran, Computer Algorithms Part 2 1 3 Maximum Selection Problem : Given n numbers, x 1, x 2,, x
More informationDirect Routing: Algorithms and Complexity
Direct Routing: Algorithms and Complexity Costas Busch, RPI Malik Magdon-Ismail, RPI Marios Mavronicolas, Univ. Cyprus Paul Spirakis, Univ. Patras 1 Outline 1. Direct Routing. 2. Direct Routing is Hard.
More information5. DIVIDE AND CONQUER I
5. DIVIDE AND CONQUER I mergesort counting inversions closest pair of points randomized quicksort median and selection Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley Copyright 2013
More informationPerformance of Multihop Communications Using Logical Topologies on Optical Torus Networks
Performance of Multihop Communications Using Logical Topologies on Optical Torus Networks X. Yuan, R. Melhem and R. Gupta Department of Computer Science University of Pittsburgh Pittsburgh, PA 156 fxyuan,
More informationAn Optimal Parallel Algorithm for Merging using Multiselection
An Optimal Parallel Algorithm for Merging using Multiselection Narsingh Deo Amit Jain Muralidhar Medidi Department of Computer Science, University of Central Florida, Orlando, FL 32816 Keywords: selection,
More informationA General Class of Heuristics for Minimum Weight Perfect Matching and Fast Special Cases with Doubly and Triply Logarithmic Errors 1
Algorithmica (1997) 18: 544 559 Algorithmica 1997 Springer-Verlag New York Inc. A General Class of Heuristics for Minimum Weight Perfect Matching and Fast Special Cases with Doubly and Triply Logarithmic
More informationTheorem 2.9: nearest addition algorithm
There are severe limits on our ability to compute near-optimal tours It is NP-complete to decide whether a given undirected =(,)has a Hamiltonian cycle An approximation algorithm for the TSP can be used
More information1 Probabilistic analysis and randomized algorithms
1 Probabilistic analysis and randomized algorithms Consider the problem of hiring an office assistant. We interview candidates on a rolling basis, and at any given point we want to hire the best candidate
More informationEfficient Bufferless Packet Switching on Trees and Leveled Networks
Efficient Bufferless Packet Switching on Trees and Leveled Networks Costas Busch Malik Magdon-Ismail Marios Mavronicolas Abstract In bufferless networks the packets cannot be buffered while they are in
More informationSorting (Chapter 9) Alexandre David B2-206
Sorting (Chapter 9) Alexandre David B2-206 1 Sorting Problem Arrange an unordered collection of elements into monotonically increasing (or decreasing) order. Let S = . Sort S into S =
More informationLecture 8 Parallel Algorithms II
Lecture 8 Parallel Algorithms II Dr. Wilson Rivera ICOM 6025: High Performance Computing Electrical and Computer Engineering Department University of Puerto Rico Original slides from Introduction to Parallel
More informationSORTING, SETS, AND SELECTION
CHAPTER 11 SORTING, SETS, AND SELECTION ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND MOUNT (WILEY 2004) AND SLIDES FROM
More informationFaster, Space-Efficient Selection Algorithms in Read-Only Memory for Integers
Faster, Space-Efficient Selection Algorithms in Read-Only Memory for Integers Timothy M. Chan 1, J. Ian Munro 1, and Venkatesh Raman 2 1 Cheriton School of Computer Science, University of Waterloo, Waterloo,
More informationEECS 2011M: Fundamentals of Data Structures
M: Fundamentals of Data Structures Instructor: Suprakash Datta Office : LAS 3043 Course page: http://www.eecs.yorku.ca/course/2011m Also on Moodle Note: Some slides in this lecture are adopted from James
More informationSuperconcentrators of depth 2 and 3; odd levels help (rarely)
Superconcentrators of depth 2 and 3; odd levels help (rarely) Noga Alon Bellcore, Morristown, NJ, 07960, USA and Department of Mathematics Raymond and Beverly Sackler Faculty of Exact Sciences Tel Aviv
More informationSeminar on Algorithms and Data Structures: Multiple-Edge-Fault-Tolerant Approximate Shortest-Path Trees [1]
Seminar on Algorithms and Data Structures: Multiple-Edge-Fault-Tolerant Approximate Shortest-Path Trees [1] Philipp Rimle April 14, 2018 1 Introduction Given a graph with positively real-weighted undirected
More informationSorting Algorithms. Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar
Sorting Algorithms Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text ``Introduction to Parallel Computing'', Addison Wesley, 2003. Topic Overview Issues in Sorting on Parallel
More informationConstant Queue Routing on a Mesh 1
Constant Queue Routing on a Mesh 1 Sanguthevar Rajasekaran Richard Overholt Dept. of Computer and Information Science Univ. of Pennsylvania, Philadelphia, PA 19104 1 A preliminary version of this paper
More informationFundamental mathematical techniques reviewed: Mathematical induction Recursion. Typically taught in courses such as Calculus and Discrete Mathematics.
Fundamental mathematical techniques reviewed: Mathematical induction Recursion Typically taught in courses such as Calculus and Discrete Mathematics. Techniques introduced: Divide-and-Conquer Algorithms
More informationCS 598: Communication Cost Analysis of Algorithms Lecture 15: Communication-optimal sorting and tree-based algorithms
CS 598: Communication Cost Analysis of Algorithms Lecture 15: Communication-optimal sorting and tree-based algorithms Edgar Solomonik University of Illinois at Urbana-Champaign October 12, 2016 Defining
More informationData Communication and Parallel Computing on Twisted Hypercubes
Data Communication and Parallel Computing on Twisted Hypercubes E. Abuelrub, Department of Computer Science, Zarqa Private University, Jordan Abstract- Massively parallel distributed-memory architectures
More informationMAXIMAL PLANAR SUBGRAPHS OF FIXED GIRTH IN RANDOM GRAPHS
MAXIMAL PLANAR SUBGRAPHS OF FIXED GIRTH IN RANDOM GRAPHS MANUEL FERNÁNDEZ, NICHOLAS SIEGER, AND MICHAEL TAIT Abstract. In 99, Bollobás and Frieze showed that the threshold for G n,p to contain a spanning
More informationtime using O( n log n ) processors on the EREW PRAM. Thus, our algorithm improves on the previous results, either in time complexity or in the model o
Reconstructing a Binary Tree from its Traversals in Doubly-Logarithmic CREW Time Stephan Olariu Michael Overstreet Department of Computer Science, Old Dominion University, Norfolk, VA 23529 Zhaofang Wen
More informationfor Hypercubic Networks Abstract This paper presents several deterministic algorithms for selecting the kth largest record
Sorting-Based Selection Algorithms for Hypercubic Networks P. Berthome 1 A. Ferreira 1;2 B. M. Maggs 3 S. Perennes 1 C. G. Plaxton 4 Abstract This paper presents several deterministic algorithms for selecting
More informationInterval Stabbing Problems in Small Integer Ranges
Interval Stabbing Problems in Small Integer Ranges Jens M. Schmidt Freie Universität Berlin, Germany Enhanced version of August 2, 2010 Abstract Given a set I of n intervals, a stabbing query consists
More informationCOMP3121/3821/9101/ s1 Assignment 1
Sample solutions to assignment 1 1. (a) Describe an O(n log n) algorithm (in the sense of the worst case performance) that, given an array S of n integers and another integer x, determines whether or not
More informationLesson 1 4. Prefix Sum Definitions. Scans. Parallel Scans. A Naive Parallel Scans
Lesson 1 4 Prefix Sum Definitions Prefix sum given an array...the prefix sum is the sum of all the elements in the array from the beginning to the position, including the value at the position. The sequential
More informationCache-Oblivious Traversals of an Array s Pairs
Cache-Oblivious Traversals of an Array s Pairs Tobias Johnson May 7, 2007 Abstract Cache-obliviousness is a concept first introduced by Frigo et al. in [1]. We follow their model and develop a cache-oblivious
More informationCS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics
CS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics 1 Sorting 1.1 Problem Statement You are given a sequence of n numbers < a 1, a 2,..., a n >. You need to
More informationRange Mode and Range Median Queries on Lists and Trees
Range Mode and Range Median Queries on Lists and Trees Danny Krizanc 1, Pat Morin 2, and Michiel Smid 2 1 Department of Mathematics and Computer Science, Wesleyan University, Middletown, CT 06459 USA dkrizanc@wesleyan.edu
More informationCSC 447: Parallel Programming for Multi- Core and Cluster Systems
CSC 447: Parallel Programming for Multi- Core and Cluster Systems Parallel Sorting Algorithms Instructor: Haidar M. Harmanani Spring 2016 Topic Overview Issues in Sorting on Parallel Computers Sorting
More informationModels and Algorithms for Optical and Optoelectronic Parallel Computers
Models and Algorithms for Optical and Optoelectronic Parallel Computers artaj ahni Dept. of Computer and Information cience and ngineering University of Florida Gainesville, FL 32611, UA sahni@cise.ufl.edu
More informationUnit 6 Chapter 15 EXAMPLES OF COMPLEXITY CALCULATION
DESIGN AND ANALYSIS OF ALGORITHMS Unit 6 Chapter 15 EXAMPLES OF COMPLEXITY CALCULATION http://milanvachhani.blogspot.in EXAMPLES FROM THE SORTING WORLD Sorting provides a good set of examples for analyzing
More informationSankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment
Class: V - CE Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology Sub: Design and Analysis of Algorithms Analysis of Algorithm: Assignment
More informationGreedy algorithms is another useful way for solving optimization problems.
Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. Optimization Problems For the given input, we are seeking solutions that must satisfy certain conditions. These
More informationComplexity Analysis of Routing Algorithms in Computer Networks
Complexity Analysis of Routing Algorithms in Computer Networks Peter BARTALOS Slovak University of Technology Faculty of Informatics and Information Technologies Ilkovičova 3, 84 6 Bratislava, Slovakia
More informationRandomized Algorithms
Randomized Algorithms Last time Network topologies Intro to MPI Matrix-matrix multiplication Today MPI I/O Randomized Algorithms Parallel k-select Graph coloring Assignment 2 Parallel I/O Goal of Parallel
More information7. Sorting I. 7.1 Simple Sorting. Problem. Algorithm: IsSorted(A) 1 i j n. Simple Sorting
Simple Sorting 7. Sorting I 7.1 Simple Sorting Selection Sort, Insertion Sort, Bubblesort [Ottman/Widmayer, Kap. 2.1, Cormen et al, Kap. 2.1, 2.2, Exercise 2.2-2, Problem 2-2 19 197 Problem Algorithm:
More informationLecture 27: Fast Laplacian Solvers
Lecture 27: Fast Laplacian Solvers Scribed by Eric Lee, Eston Schweickart, Chengrun Yang November 21, 2017 1 How Fast Laplacian Solvers Work We want to solve Lx = b with L being a Laplacian matrix. Recall
More informationComp Online Algorithms
Comp 7720 - Online Algorithms Notes 4: Bin Packing Shahin Kamalli University of Manitoba - Fall 208 December, 208 Introduction Bin packing is one of the fundamental problems in theory of computer science.
More informationSorting (Chapter 9) Alexandre David B2-206
Sorting (Chapter 9) Alexandre David B2-206 Sorting Problem Arrange an unordered collection of elements into monotonically increasing (or decreasing) order. Let S = . Sort S into S =
More informationCOMP Analysis of Algorithms & Data Structures
COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Lecture 7 - Jan. 17, 2018 CLRS 7.1, 7-4, 9.1, 9.3 University of Manitoba COMP 3170 - Analysis of Algorithms & Data Structures 1 / 11 QuickSelect
More informationAverage Case Analysis for Tree Labelling Schemes
Average Case Analysis for Tree Labelling Schemes Ming-Yang Kao 1, Xiang-Yang Li 2, and WeiZhao Wang 2 1 Northwestern University, Evanston, IL, USA, kao@cs.northwestern.edu 2 Illinois Institute of Technology,
More informationGraph Contraction. Graph Contraction CSE341T/CSE549T 10/20/2014. Lecture 14
CSE341T/CSE549T 10/20/2014 Lecture 14 Graph Contraction Graph Contraction So far we have mostly talking about standard techniques for solving problems on graphs that were developed in the context of sequential
More informationLecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for Advanced Algorithms, Fall 2013.
Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for 4540 - Advanced Algorithms, Fall 2013. Today s topic: Karger s min-cut algorithm [3]. Problem Definition
More informationIntroduction to Parallel Computing
Introduction to Parallel Computing George Karypis Sorting Outline Background Sorting Networks Quicksort Bucket-Sort & Sample-Sort Background Input Specification Each processor has n/p elements A ordering
More informationCOMP Analysis of Algorithms & Data Structures
COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Lecture 6 - Jan. 15, 2018 CLRS 7.1, 7-4, 9.1, 9.3 University of Manitoba COMP 3170 - Analysis of Algorithms & Data Structures 1 / 12 Quick-sort
More informationCSE4502/5717: Big Data Analytics Prof. Sanguthevar Rajasekaran Lecture 7 02/14/2018; Notes by Aravind Sugumar Rajan Recap from last class:
CSE4502/5717: Big Data Analytics Prof. Sanguthevar Rajasekaran Lecture 7 02/14/2018; Notes by Aravind Sugumar Rajan Recap from last class: Prim s Algorithm: Grow a subtree by adding one edge to the subtree
More informationFast Clustering using MapReduce
Fast Clustering using MapReduce Alina Ene Sungjin Im Benjamin Moseley September 6, 2011 Abstract Clustering problems have numerous applications and are becoming more challenging as the size of the data
More informationHow many leaves on the decision tree? There are n! leaves, because every permutation appears at least once.
Chapter 8. Sorting in Linear Time Types of Sort Algorithms The only operation that may be used to gain order information about a sequence is comparison of pairs of elements. Quick Sort -- comparison-based
More informationII (Sorting and) Order Statistics
II (Sorting and) Order Statistics Heapsort Quicksort Sorting in Linear Time Medians and Order Statistics 8 Sorting in Linear Time The sorting algorithms introduced thus far are comparison sorts Any comparison
More informationThe divide and conquer strategy has three basic parts. For a given problem of size n,
1 Divide & Conquer One strategy for designing efficient algorithms is the divide and conquer approach, which is also called, more simply, a recursive approach. The analysis of recursive algorithms often
More informationDIVIDE AND CONQUER ALGORITHMS ANALYSIS WITH RECURRENCE EQUATIONS
CHAPTER 11 SORTING ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND MOUNT (WILEY 2004) AND SLIDES FROM NANCY M. AMATO AND
More informationCSCE 321/3201 Analysis and Design of Algorithms. Prof. Amr Goneid. Fall 2016
CSCE 321/3201 Analysis and Design of Algorithms Prof. Amr Goneid Fall 2016 CSCE 321/3201 Analysis and Design of Algorithms Prof. Amr Goneid Course Resources Instructor: Prof. Amr Goneid E-mail: goneid@aucegypt.edu
More informationCOMP Data Structures
COMP 2140 - Data Structures Shahin Kamali Topic 5 - Sorting University of Manitoba Based on notes by S. Durocher. COMP 2140 - Data Structures 1 / 55 Overview Review: Insertion Sort Merge Sort Quicksort
More informationSolutions. Suppose we insert all elements of U into the table, and let n(b) be the number of elements of U that hash to bucket b. Then.
Assignment 3 1. Exercise [11.2-3 on p. 229] Modify hashing by chaining (i.e., bucketvector with BucketType = List) so that BucketType = OrderedList. How is the runtime of search, insert, and remove affected?
More informationPresentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, Merge Sort & Quick Sort
Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 Merge Sort & Quick Sort 1 Divide-and-Conquer Divide-and conquer is a general algorithm
More informationSpace Efficient Linear Time Construction of
Space Efficient Linear Time Construction of Suffix Arrays Pang Ko and Srinivas Aluru Dept. of Electrical and Computer Engineering 1 Laurence H. Baker Center for Bioinformatics and Biological Statistics
More informationPrefix Computation and Sorting in Dual-Cube
Prefix Computation and Sorting in Dual-Cube Yamin Li and Shietung Peng Department of Computer Science Hosei University Tokyo - Japan {yamin, speng}@k.hosei.ac.jp Wanming Chu Department of Computer Hardware
More informationCrossing Numbers and Parameterized Complexity
Crossing Numbers and Parameterized Complexity MichaelJ.Pelsmajer 1, Marcus Schaefer 2, and Daniel Štefankovič3 1 Illinois Institute of Technology, Chicago, IL 60616, USA pelsmajer@iit.edu 2 DePaul University,
More informationA Top-Down Parallel Semisort
A Top-Down Parallel Semisort Yan Gu Carnegie Mellon University yan.gu@cs.cmu.edu Julian Shun Carnegie Mellon University jshun@cs.cmu.edu Guy E. Blelloch Carnegie Mellon University guyb@cs.cmu.edu Yihan
More informationSorting is a problem for which we can prove a non-trivial lower bound.
Sorting The sorting problem is defined as follows: Sorting: Given a list a with n elements possessing a total order, return a list with the same elements in non-decreasing order. Remember that total order
More informationHierarchical Memory. Modern machines have complicated memory hierarchy
Hierarchical Memory Modern machines have complicated memory hierarchy Levels get larger and slower further away from CPU Data moved between levels using large blocks Lecture 2: Slow IO Review Disk access
More informationIntroduction to Randomized Algorithms
Introduction to Randomized Algorithms Gopinath Mishra Advanced Computing and Microelectronics Unit Indian Statistical Institute Kolkata 700108, India. Organization 1 Introduction 2 Some basic ideas from
More information* (4.1) A more exact setting will be specified later. The side lengthsj are determined such that
D D Chapter 4 xtensions of the CUB MTOD e present several generalizations of the CUB MTOD In section 41 we analyze the query algorithm GOINGCUB The difference to the CUB MTOD occurs in the case when the
More informationThe Effect of Adaptivity on the Performance of the OTIS-Hypercube under Different Traffic Patterns
The Effect of Adaptivity on the Performance of the OTIS-Hypercube under Different Traffic Patterns H. H. Najaf-abadi 1, H. Sarbazi-Azad 2,1 1 School of Computer Science, IPM, Tehran, Iran. 2 Computer Engineering
More informationIntroduction. e.g., the item could be an entire block of information about a student, while the search key might be only the student's name
Chapter 7 Sorting 2 Introduction sorting fundamental task in data management well-studied problem in computer science basic problem given an of items where each item contains a key, rearrange the items
More informationLecture 9: Sorting Algorithms
Lecture 9: Sorting Algorithms Bo Tang @ SUSTech, Spring 2018 Sorting problem Sorting Problem Input: an array A[1..n] with n integers Output: a sorted array A (in ascending order) Problem is: sort A[1..n]
More information5 Parallel Shortest Paths Computations and Breadth First Search on Undirected Graphs Ullmann and Yannakakis's algorithm for Breadth First Searc
Handbook of Combinatorial Optimization D.-Z. Du and P.M. Pardalos (Eds.) pp. - cfl1998 Kluwer Academic Publishers Randomized Parallel Algorithms for Combinatorial Optimization Sanguthevar Rajasekaran Department
More informationPAPER Node-Disjoint Paths Algorithm in a Transposition Graph
2600 IEICE TRANS. INF. & SYST., VOL.E89 D, NO.10 OCTOBER 2006 PAPER Node-Disjoint Paths Algorithm in a Transposition Graph Yasuto SUZUKI, Nonmember, Keiichi KANEKO a), and Mario NAKAMORI, Members SUMMARY
More informationLecture 19 Sorting Goodrich, Tamassia
Lecture 19 Sorting 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9 7 7 2 2 9 9 4 4 2004 Goodrich, Tamassia Outline Review 3 simple sorting algorithms: 1. selection Sort (in previous course) 2. insertion Sort (in previous
More informationTreaps. 1 Binary Search Trees (BSTs) CSE341T/CSE549T 11/05/2014. Lecture 19
CSE34T/CSE549T /05/04 Lecture 9 Treaps Binary Search Trees (BSTs) Search trees are tree-based data structures that can be used to store and search for items that satisfy a total order. There are many types
More informationCS302 Topic: Algorithm Analysis #2. Thursday, Sept. 21, 2006
CS302 Topic: Algorithm Analysis #2 Thursday, Sept. 21, 2006 Analysis of Algorithms The theoretical study of computer program performance and resource usage What s also important (besides performance/resource
More information