Advanced Topics in Algorithms and Data Structures 1 Lecture 4 : Accelerated Cascading and Parallel List Ranking We will first discuss a technique called.

Slides:



Advertisements
Similar presentations
General algorithmic techniques: Balanced binary tree technique Doubling technique: List Ranking Problem Divide and concur Lecture 6.
Advertisements

Parallel List Ranking Advanced Algorithms & Data Structures Lecture Theme 17 Prof. Dr. Th. Ottmann Summer Semester 2006.
1 Parallel Algorithms (chap. 30, 1 st edition) Parallel: perform more than one operation at a time. PRAM model: Parallel Random Access Model. p0p0 p1p1.
Parallel Algorithms.
Introduction to Algorithms Quicksort
Advanced Topics in Algorithms and Data Structures
Optimal PRAM algorithms: Efficiency of concurrent writing “Computer science is no more about computers than astronomy is about telescopes.” Edsger Dijkstra.
Advanced Topics in Algorithms and Data Structures Lecture 7.2, page 1 Merging two upper hulls Suppose, UH ( S 2 ) has s points given in an array according.
Lecture 3: Parallel Algorithm Design
Greedy Algorithms Amihood Amir Bar-Ilan University.
BY Lecturer: Aisha Dawood. Heapsort  O(n log n) worst case like merge sort.  Sorts in place like insertion sort.  Combines the best of both algorithms.
Advanced Algorithms Piyush Kumar (Lecture 12: Parallel Algorithms) Welcome to COT5405 Courtesy Baker 05.
Deterministic Selection and Sorting Prepared by John Reif, Ph.D. Analysis of Algorithms.
Advanced Topics in Algorithms and Data Structures Lecture 7.1, page 1 An overview of lecture 7 An optimal parallel algorithm for the 2D convex hull problem,
Advanced Topics in Algorithms and Data Structures Lecture pg 1 Recursion.
September 19, Algorithms and Data Structures Lecture IV Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Advanced Topics in Algorithms and Data Structures 1 Rooting a tree For doing any tree computation, we need to know the parent p ( v ) for each node v.
Advanced Topics in Algorithms and Data Structures Classification of the PRAM model In the PRAM model, processors communicate by reading from and writing.
PRAM Models Advanced Algorithms & Data Structures Lecture Theme 13 Prof. Dr. Th. Ottmann Summer Semester 2006.
Advanced Topics in Algorithms and Data Structures Lecture 6.1 – pg 1 An overview of lecture 6 A parallel search algorithm A parallel merging algorithm.
Parallel Prefix Computation Advanced Algorithms & Data Structures Lecture Theme 14 Prof. Dr. Th. Ottmann Summer Semester 2006.
Advanced Topics in Algorithms and Data Structures Page 1 Parallel merging through partitioning The partitioning strategy consists of: Breaking up the given.
Simulating a CRCW algorithm with an EREW algorithm Efficient Parallel Algorithms COMP308.
Uzi Vishkin.  Introduction  Objective  Model of Parallel Computation ▪ Work Depth Model ( ~ PRAM) ▪ Informal Work Depth Model  PRAM Model  Technique:
Lecture 5: Linear Time Sorting Shang-Hua Teng. Sorting Input: Array A[1...n], of elements in arbitrary order; array size n Output: Array A[1...n] of the.
CS 253: Algorithms Chapter 8 Sorting in Linear Time Credit: Dr. George Bebis.
Heaps Heaps are used to efficiently implement two operations:
A Binary Tree root leaf. A Binary Tree root leaf descendent of root parent of leaf.
CSE621/JKim Lec4.1 9/20/99 CSE621 Parallel Algorithms Lecture 4 Matrix Operation September 20, 1999.
1 Lecture 11 Sorting Parallel Computing Fall 2008.
Accelerated Cascading Advanced Algorithms & Data Structures Lecture Theme 16 Prof. Dr. Th. Ottmann Summer Semester 2006.
Topics: 1. Trees - properties 2. The master theorem 3. Decoders מבנה המחשב - אביב 2004 תרגול 4#
2 -1 Analysis of algorithms Best case: easiest Worst case Average case: hardest.
CS 280 Data Structures Professor John Peterson. Invariants Back to Invariants! Recall the insertion sort invariant – how can we turn this into debugging.
@ Zhigang Zhu, CSC212 Data Structure - Section RS Lecture 18a Trees, Logs and Time Analysis Instructor: Zhigang Zhu Department of Computer.
Parallel Merging Advanced Algorithms & Data Structures Lecture Theme 15 Prof. Dr. Th. Ottmann Summer Semester 2006.
CS 206 Introduction to Computer Science II 12 / 03 / 2008 Instructor: Michael Eckmann.
Lecture 5: Master Theorem and Linear Time Sorting
Advanced Topics in Algorithms and Data Structures Page 1 An overview of lecture 3 A simple parallel algorithm for computing parallel prefix. A parallel.
Topic Overview One-to-All Broadcast and All-to-One Reduction
DAST 2005 Week 4 – Some Helpful Material Randomized Quick Sort & Lower bound & General remarks…
Fall 2008Paradigms for Parallel Algorithms1 Paradigms for Parallel Algorithms.
Advanced Topics in Algorithms and Data Structures 1 Two parallel list ranking algorithms An O (log n ) time and O ( n log n ) work list ranking algorithm.
Basic PRAM algorithms Problem 1. Min of n numbers Problem 2. Computing a position of the first one in the sequence of 0’s and 1’s.
Simulating a CRCW algorithm with an EREW algorithm Lecture 4 Efficient Parallel Algorithms COMP308.
Advanced Topics in Algorithms and Data Structures 1 An example.
Computer Algorithms Lecture 11 Sorting in Linear Time Ch. 8
1 Trees A tree is a data structure used to represent different kinds of data and help solve a number of algorithmic problems Game trees (i.e., chess ),
Binary Trees. Binary Tree Finite (possibly empty) collection of elements A nonempty binary tree has a root element The remaining elements (if any) are.
Design of Algorithms using Brute Force Approach. Primality Testing (given number is n binary digits)
September 29, Algorithms and Data Structures Lecture V Simonas Šaltenis Aalborg University
Chapter 21 Binary Heap.
Fall 2015 Lecture 4: Sorting in linear time
Discrete Structures Lecture 12: Trees Ji Yanyan United International College Thanks to Professor Michael Hvidsten.
Parallel Algorithms. Parallel Models u Hypercube u Butterfly u Fully Connected u Other Networks u Shared Memory v.s. Distributed Memory u SIMD v.s. MIMD.
ICS 353: Design and Analysis of Algorithms Heaps and the Disjoint Sets Data Structures King Fahd University of Petroleum & Minerals Information & Computer.
Foundation of Computing Systems
Counting and Distributed Coordination BASED ON CHAPTER 12 IN «THE ART OF MULTIPROCESSOR PROGRAMMING» LECTURE BY: SAMUEL AMAR.
3/12/2013Computer Engg, IIT(BHU)1 PRAM ALGORITHMS-3.
3/12/2013Computer Engg, IIT(BHU)1 PRAM ALGORITHMS-1.
Merge Sort 1/12/2018 5:48 AM Merge Sort 7 2   7  2  2 7
Lecture 3: Parallel Algorithm Design
Ch 6: Heapsort Ming-Te Chi
ICS 353: Design and Analysis of Algorithms
CS200: Algorithm Analysis
ICS 353: Design and Analysis of Algorithms
Unit –VIII PRAM Algorithms.
Heaps.
Presentation transcript:

Advanced Topics in Algorithms and Data Structures 1 Lecture 4 : Accelerated Cascading and Parallel List Ranking We will first discuss a technique called accelerated cascading for designing very fast parallel algorithms. We will then study a very important technique for ranking the elements of a list in parallel.

Advanced Topics in Algorithms and Data Structures 2 Fast computation of maximum Input: An array A holding p elements from a linearly ordered universe S. We assume that all the elements in A are distinct. Output: The maximum element from the array A. We use a boolean array M such that M ( k )=1 if and only if A ( k ) is the maximum element in A. Initialization: We allocate p processors to set each entry in M to 1.

Advanced Topics in Algorithms and Data Structures 3 Fast computation of maximum Step 1: Assign p processors for each element in A, p 2 processors overall. Consider the p processors allocated to A ( j ). We name these processors as P 1, P 2,..., P i,..., P p. P i compares A ( j ) with A ( i ) : If A ( i ) > A ( j ) then M ( j ) := 0 else do nothing.

Advanced Topics in Algorithms and Data Structures 4 Fast computation of maximum Step 2: At the end of Step 1, M ( k ), 1  k  p will be 1 if and only if A ( k ) is the maximum element. We allocate p processors, one for each entry in M. If the entry is 0, the processor does nothing. If the entry is 1, it outputs the index k of the maximum element.

Advanced Topics in Algorithms and Data Structures 5 Fast computation of maximum Complexity: The processor requirement is p 2 and the time complexity is O (1). We need concurrent write facility and hence the Common CRCW PRAM model.

Advanced Topics in Algorithms and Data Structures 6 Optimal computation of maximum This is the same algorithm which we used for adding n numbers.

Advanced Topics in Algorithms and Data Structures 7 Optimal computation of maximum This algorithm takes O ( n ) processors and O (log n ) time. We can reduce the processor complexity to O ( n / log n ). Hence the algorithm does optimal O ( n ) work.

Advanced Topics in Algorithms and Data Structures 8 An O (log log n ) time algorithm Instead of a binary tree, we use a more complex tree. Assume that. The root of the tree has children. Each node at the i -th level has children for. Each node at level k has two children.

Advanced Topics in Algorithms and Data Structures 9 An O (log log n ) time algorithm Some Properties The depth of the tree is k. Since The number of nodes at the i -th level is Prove this by induction.

Advanced Topics in Algorithms and Data Structures 10 An O (log log n ) time algorithm The Algorithm The algorithm proceeds level by level, starting from the leaves. At every level, we compute the maximum of all the children of an internal node by the O (1) time algorithm. The time complexity is O (log log n ) since the depth of the tree is O (log log n ).

Advanced Topics in Algorithms and Data Structures 11 An O (log log n ) time algorithm Total Work: Recall that the O (1) time algorithm needs O ( p 2 ) work for p elements. Each node at the i -th level has children. So the total work for each node at the i -th level is.

Advanced Topics in Algorithms and Data Structures 12 An O (log log n ) time algorithm Total Work: There are nodes at the i -th level. Hence the total work for the i -th level is: For O (log log n ) levels, the total work is O ( n log log n ). This is suboptimal.

Advanced Topics in Algorithms and Data Structures 13 Accelerated cascading The first algorithm which is based on a binary tree, is optimal but slow. The second algorithm is suboptimal, but very fast. We combine these two algorithms through the accelerated cascading strategy.

Advanced Topics in Algorithms and Data Structures 14 Accelerated cascading We start with the optimal algorithm until the size of the problem is reduced to a certain value. Then we use the suboptimal but very fast algorithm.

Advanced Topics in Algorithms and Data Structures 15 Accelerated cascading Phase 1. We apply the binary tree algorithm, starting from the leaves and upto log log log n levels. The number of candidates reduces to The total work done so far is O ( n ) and the total time is O (log log log n ).

Advanced Topics in Algorithms and Data Structures 16 Accelerated cascading Phase 2. In this phase, we use the fast algorithm on the remaining candidates. The total work is. The total time is. Theorem: Maximum of n elements can be computed in O (log log n ) time and O ( n ) work on the Common CRCW PRAM.