would be included in is small: to be exact. Thus with probability1, the same partition n+1 n+1 would be produced regardless of whether p is in the inp

Size: px
Start display at page:

Download "would be included in is small: to be exact. Thus with probability1, the same partition n+1 n+1 would be produced regardless of whether p is in the inp"

Transcription

1 1 Introduction 1.1 Parallel Randomized Algorihtms Using Sampling A fundamental strategy used in designing ecient algorithms is divide-and-conquer, where that input data is partitioned into several subproblems which are solved recursively. The solutions to the subproblems are then merged to form the solution of the original problem. Two issues arise when designing a divide-and-conquer algorithm: how to partition the data and how to merge subproblems. Sometimes there is a tradeo between ease of partitioning and the time needed for the merging step; careful partitioning may take more time but could lead to a more ecient methods of combining solutions. One method of partitioning input is random sampling. This technique has been used successfully in designing ecient parallel algorithms for problems in computational geometry [?,?]. A random sample of the input points, typically of size n for some 0 < < 1, is used to partition the data space so that each input point is included in one or more of the partitions. In some applications the input is not partitioned but rather decomposed into such that an input point may be placed in more than one set. If that is the case, the total size of all sets is kept bounded to avoid explosion of the work bounds. For sequential algorithms, Clarkson [?] showed that random sampling can be used to give a simple, general technique for building geometric structures incrementally and fast processing of random input points. In this paper we describe a useful technique that enables us to transform algorithms that use random sampling to partition the data into dynamic algorithms that allow insertion and deletion of data points. Dynamic (or incremental) algorithms update their output of a solution to a problem when the input is dynamically modied. Usually it is not practical to recompute the solution \from scratch", so special data structures are devised that can be updated at small cost. Dynamic algorithms are very useful in interactive applications, including network optimization, VLSI, and computer graphics. Many dynamic data structures have been devised to deal with problems in computational geometry [3, 2]. Throughout the rest of this paper we will refer to algorithms with xed input as static algorithms, and to algorithms with a dynamically changing input set as dynamic algorithms. 1.2 Dynamizing Static Randomized Algorithms We can visualize a divide-and-conquer parallel algorithm as a tree. The input set is stored at the root. The root has one child for each partition of the input, and that child node stores the elements of that partition. Each child node is is then recursively partitioned. Recursion stops when the number of data points stored at a leaf node drops below a specied bound, usually a polylog function of the input size. One of the requirements for an ecient dynamic algorithm is that this algorithm tree and the corresponding data structures will remain balanced throughtout the execution of the dynamic algorithm. Below we describe a general technique that achieves this goal. Note that this is a general technique, and details have to be tailored to suit specic implementations. Later in the paper we describe in detail how this technique can be used in a convex hull algorithm. Consider a simple static algorithm A which, given an input set I of size n, uses information from a small subset of size of the input to partition its data set. Let the work performed by A be T(n). Now consider a new data point p being presented to the algorithm to be inserted into the input set (a similar argument holds for deleting a data point). Suppose I [ p was input to A. Since the partition of the data set depends only on a small sample of the input set, the probability that p 1

2 would be included in is small: to be exact. Thus with probability1, the same partition n+1 n+1 would be produced regardless of whether p is in the input set. By performing a single Bernoulli trial, we can decide whether or not the partition should be aected by insertion or deletion of p. If the answer is \yes", we invoke the static algorithm A, repartitioning the input and recomputing the output from scratch. The probability of this happening is. Since the cost of invoking A is n+1 at most T (n + 1), the cost of adding the new input point p is at most T (n + 1). n+1 If repartitioning does not take place, we look at the current partitioning of the data set and determine which partition p falls into. We then recursively repeat the process on that partition. The dynamic maintenance of the algorithm tree and corresponding data structures proceeds inductively. At each step, the following induction hypothesis holds: After a sequence of any number of updates to the input, the partitioning of the data points will have the same probability distribution as a partitioning achieved by the static algorithm, had the same input been presented to it. With each new insertion or deletion, with probability at most the entire data set may be n completely repartitioned by the static algorithm, using unbiased independent random sampling. After each step, the induction still holds. Section 3 gives more details of this approach. 2 A Static, Randomized, Convex Hull Algorithm We describe a randomized divide-and-conquer convex algorithm. In many respects it is similar to the deterministic convex hull algorithm of []. We give rst a high-level description, followed by a more detailed description. Algorithm 1 Input: A set P of n points in the plane. Output: The convex hull of P. 1. Sort the input points by their x-coordinate. 2. Divide the points into an upper and a lower hull. Without loss of generality, the rest of the algorithm deals with the construction of the upper hull. The lower hull is constructed similarly. 3. Let n 0 be the number of points in the input. Randomly select a sample 0 containing s(n 0 )= n 0 points of the input. These points split the plane into s(n 0) sectors; the borders of the sectors are the rays emanating from a central point and going through each of the points in the sample. The size of each sector is the number of points within the sector. The expected size of each sector is n 1, Recursively compute the convex hull of each sector. 5. Combine the sector hulls into a single hull. We now give a more detailed description of the recursive construction and the merge step. 2.1 Recursive construction of a sector hull We dene a partition tree of the point set as follows: The input points are stored in the leaves of a tree. The internal nodes of the tree dene the recursive partitioning of the sectors. Each internal node at level i corresponds to a sector at the ith recursion level, and is the root of a subtree which contains the points included in that sector. The size of a subtree is the number of points stored in its leaves. 2

3 Lemma 2.1 The expected size of a subtree rooted at level i of the partition tree is n i = n 1,i Partition the points in each sector. At level i of the recursion, a sector contains n i points and is partitioned into s i subsectors by a random sample i of size s i = n. i The root of the tree is considered to be level 0. The root has s 0 = n 0 children, each corresponding to a sector. A subtree rooted at level i has s i = n children, each corresponding to a sub i sector. Lemma 2.2 The expected number of children of a node at level i of the partition tree is s i = n (1,)i. Dene L i to be the number of internal nodes at level i of the tree, that is, the number of subsectors at the ith level of recursion. Lemma 2.3 The expected size of L i is n 1,(1,e)i. Proof: The number of internal nodes at a given level of the partition tree is the number of nodes at one higher level times their expected number of children, giving the recursion L i = L i,1 s i,1 = L i,1 n 1,i,1 with L 0 = 1 (the root). Solving this recurrence, we get where L i = i,1 j=0 n(1,)j = n f (;i) = n 1,(1,)i f(; i) = i,1 (1 1 j=0,, (1, )i = )j 1, (1, ) =1,(1, )i 2 7 Alternate proof: The leaves of the tree contain all n 0 = O(n) input points. From Lemma 2.1, the expected size of a subtree is n 1,i. Since the subtrees dene a partition, they are disjoint. Thus the expected number of subtrees is n=n 1,i = n 1,(1,)i. 2 The recursion stops when the average sector size is log c n for some constant c. Lemma 2.4 The expected depth of the partition tree is O(log log n). Proof: The size of a sector at level i of the partition is n 1,i (Lemma 2.1). To nd the level when this size is polylog, solve n 1,k = log c n for k. 2 Partitioning a sector into subsectors has two components: selecting the random sample, which can be done in constant time per sample point, and determining which subsector each point belongs to, which can be done in constant time per input point. Lemma 2.5 The sectors at level i of the recursion can be partitioned in O(n) time. Proof: By lemma 2.3, there are n 1,(1,e)i sectors in the ith level of the recursion. By Lemma 2.2, the sample selected in each of these sectors is of size n (1,)i. Thus the time to select all the samples in this level is n 1,(1,e)i n (1,)i = n,(1,)i+1. Each of the input points falls into one subsector (if a point lies exactly on the border between two sectors, arbitrarily assign it into one of the two). It is possible to determine the subsector a point lies in in O(1) time, requiring O(n) time to determine the sectors for all input points. 1 The total time to perform the ith partition level is therefore n + = O(n). 2 n (1,)i+1 Since the depth of the partition tree is O(log log n)(by Lemma 2.4), we have: Lemma 2.6 The total time requirted to recursively partition the input point set is O(n log log n). 3

4 2.2 Merging of sector hulls Build the hulls of the sectors at the leaves of the partition tree using any standard convex hull algorithm. Build the hull of a level i sector from the (already constructed) hulls of the sectors in level i + 1, by merging pairs of adjacent hulls. Combine adjacent pairs using the upper tangent algorithm of [], which is linear in the number of points whose hulls are to be merged. This reduces the number of hulls by half. Continue merging adjacent pairs until there is only one hull. Lemma 2.7 The time required to construct one of the level i hulls is (1, ) i n (1,)i log n. Proof: By Lemmas 2.2 and 2.1, each level i sector is split into s i = n (1,)i subsectors, each of size n i+1 = n 1,i+1. Merging adjacent pairs, the merge process can be viewed as a tree of merges of depth log s i. Each merge level requires s i+1 n i+1 work (sequential time). Thus the total time required until all level i + 1 sector hulls are merged into one level i hull is s i n i+1 log s i = n (1,)i n 1,i+1 log n (1,)i = (1, ) i n (1,)i log n 2 Construction of the partition tree was a top-down process. Hulls are created at the leaves, and built bottom-up along the partition tree, with a merge step at every level. This leads to Lemma 2.8 The time required to merge the hulls at the leaves into a single hull is O(n log n). Proof: The total merge work over all levels of the tree is log log n i=0 (1, ) i n (1,)i log log n log n = log ni=0 (1, ) i n (1,)i = O(n log n) **** this is wrong!! need to multiply by the number of sectors at each level still ******* Complexity analysis Combining the results of the previous section, we have: Theorem 2.1 The algorithm computes a convex hull for a set of points in the plane in time O(n log n. In the next section, we show how to use the data structures constructed for this algorithm in a dynamic convex hull algorithm. 3 Dynamic Construction Our goal is to maintain the convex hull of a dynamically changing point set. We give algorithms for dynamic maintenance of a convex hull of a set P of points in the plane. The algorithm accepts a sequence of requests from an adversary. Each request is a pair (point, action), where an action may be to INSERT or DELETE the input point from P, or answer a QUERY about the input point, e.g. determining whether it is on the convex hull of P, or searching for it in the partition. Our algorithm proceeds inductively. Given a partition tree, the entire structure or a part thereof may be completely rebuilt using the static algorithm with each new insertion or deletion. When a request for insertion arrives, the input to that stage of the algorithm is a set of n, 1 points P 0 arranged in a partition tree, the hull obtained using that partition tree, and one additional 4

5 point p. Consider the situation where all n points are presented to the static algorithm described in the previous section. At the top level of the algorithm, the key step of the static algorithm which is important for our purpose is selecting the set 0 which is used to determine the partitioning of the points into sectors. If j 0 j = n, the probability that the new point would have not been included is1, n n.thus we perform a single Bernoulli trial, with probability of success 1,. n n Failure in this trial means that p needs to be included in the subset of points that will determine the partition. If that is the case, We need to reconstruct the whole partition. Otherwise, determine which sector the point belongs to, then recursively repeat this process, reconstructing the partition at level i with probability P i =1, n i n i. How should the reconstruction be done? A naive approach would be to call the static algorithm and redo everything. Since the probability for reconstructing the entire partition and the hull is small, one would expect the overall complexity to be reasonably bounded. However, this is not the case, and total reconstruction yields a polynomial update time. Note that even if no repartitioning needs to be done, the hull always has to be reconstructed at the leaves under this scheme. A better approach is to substitute an existing dynamic algorithm such as the O(log 2 n) dynamic update of Overmars and VanLeeuwen [4]. The data structure used in their algorithm is relatively similar and easy to tailor to the partition tree (details below). Let // P i be the probability ofupdating the partition at level i.// C i be the cost of updating the partition and hull at level i.// F i be the cost of nding which sector a point belongs to. // We get the following recursion for the total cost of an update: In this algorithm, P i T (n i ) P i C i +(1,P i )(F i )+T(n i+1 ) is the probability ofbeing included in the sample at level i which is, by lemma 2.2, n(1,)i = n,(1,)i+1. n The cost of (1,)i nding the sector that a point belongs to is the cost of performing binary search through the sectors. Note that there is no need to search through all subsectors at a level. At the top level, search through n sectors. When the sector is found at that level, need only search through its subsectors. Thus the cost of nding the subsector that a point belongs to at level i is log n = (1, log n. i )i The cost of updating the partition at level i has two components { updating the sector hull and merging the sector hull up the partition tree (levels i, 1 :::0). Perform the update in polylog time using the modied update algorithm described below in section 4. The merge step no longer involves all subsectors in a sector. Start by merging the modied subsectors with its neighbors, and stop the merge when a subsector hull is not modied by the merge. Note that in the worst case all lavel i + 1 subsectors in a level i sector are modied, and that other level i sectors may be modied in the next merge step, but that no other level i + 1 subsectors outside the sector are modied. **** I'm redoing this section now. Just found what I think is an error in the merge step. It could be a ptoblem. ******* 4 Modied dynamic convex hull algorithm 5

6 References [1] Cole R, Goodrich MT. Optimal parallel algorithms for polygon and point-set problems. Department of computer science, 88{14, Johns Hopkins University, [2] Chiang Y, Tamassia R. Dynamic algorithms in computational geometry. Tech Report CS{91{ 24, Department of Computer Science, Brown University, [3] Overmars M. The design of dynamic data structures. Lecture Notes in Computer Science, 156, [4] Overmars M, Van Leeuwen

16 Greedy Algorithms

16 Greedy Algorithms 16 Greedy Algorithms Optimization algorithms typically go through a sequence of steps, with a set of choices at each For many optimization problems, using dynamic programming to determine the best choices

More information

(2,4) Trees Goodrich, Tamassia (2,4) Trees 1

(2,4) Trees Goodrich, Tamassia (2,4) Trees 1 (2,4) Trees 9 2 5 7 10 14 2004 Goodrich, Tamassia (2,4) Trees 1 Multi-Way Search Tree A multi-way search tree is an ordered tree such that Each internal node has at least two children and stores d -1 key-element

More information

Advanced Algorithm Design and Analysis (Lecture 12) SW5 fall 2005 Simonas Šaltenis E1-215b

Advanced Algorithm Design and Analysis (Lecture 12) SW5 fall 2005 Simonas Šaltenis E1-215b Advanced Algorithm Design and Analysis (Lecture 12) SW5 fall 2005 Simonas Šaltenis E1-215b simas@cs.aau.dk Range Searching in 2D Main goals of the lecture: to understand and to be able to analyze the kd-trees

More information

The divide and conquer strategy has three basic parts. For a given problem of size n,

The 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 information

Planar Point Location

Planar Point Location C.S. 252 Prof. Roberto Tamassia Computational Geometry Sem. II, 1992 1993 Lecture 04 Date: February 15, 1993 Scribe: John Bazik Planar Point Location 1 Introduction In range searching, a set of values,

More information

II (Sorting and) Order Statistics

II (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 information

Point Enclosure and the Interval Tree

Point Enclosure and the Interval Tree C.S. 252 Prof. Roberto Tamassia Computational Geometry Sem. II, 1992 1993 Lecture 8 Date: March 3, 1993 Scribe: Dzung T. Hoang Point Enclosure and the Interval Tree Point Enclosure We consider the 1-D

More information

SORTING AND SELECTION

SORTING 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 information

6.856 Randomized Algorithms

6.856 Randomized Algorithms 6.856 Randomized Algorithms David Karger Handout #4, September 21, 2002 Homework 1 Solutions Problem 1 MR 1.8. (a) The min-cut algorithm given in class works because at each step it is very unlikely (probability

More information

1. Meshes. D7013E Lecture 14

1. Meshes. D7013E Lecture 14 D7013E Lecture 14 Quadtrees Mesh Generation 1. Meshes Input: Components in the form of disjoint polygonal objects Integer coordinates, 0, 45, 90, or 135 angles Output: A triangular mesh Conforming: A triangle

More information

CSE 530A. B+ Trees. Washington University Fall 2013

CSE 530A. B+ Trees. Washington University Fall 2013 CSE 530A B+ Trees Washington University Fall 2013 B Trees A B tree is an ordered (non-binary) tree where the internal nodes can have a varying number of child nodes (within some range) B Trees When a key

More information

CMSC 754 Computational Geometry 1

CMSC 754 Computational Geometry 1 CMSC 754 Computational Geometry 1 David M. Mount Department of Computer Science University of Maryland Fall 2005 1 Copyright, David M. Mount, 2005, Dept. of Computer Science, University of Maryland, College

More information

We can use a max-heap to sort data.

We can use a max-heap to sort data. Sorting 7B N log N Sorts 1 Heap Sort We can use a max-heap to sort data. Convert an array to a max-heap. Remove the root from the heap and store it in its proper position in the same array. Repeat until

More information

Lecture 6 Sequences II. Parallel and Sequential Data Structures and Algorithms, (Fall 2013) Lectured by Danny Sleator 12 September 2013

Lecture 6 Sequences II. Parallel and Sequential Data Structures and Algorithms, (Fall 2013) Lectured by Danny Sleator 12 September 2013 Lecture 6 Sequences II Parallel and Sequential Data Structures and Algorithms, 15-210 (Fall 2013) Lectured by Danny Sleator 12 September 2013 Material in this lecture: Today s lecture is about reduction.

More information

Figure 4.1: The evolution of a rooted tree.

Figure 4.1: The evolution of a rooted tree. 106 CHAPTER 4. INDUCTION, RECURSION AND RECURRENCES 4.6 Rooted Trees 4.6.1 The idea of a rooted tree We talked about how a tree diagram helps us visualize merge sort or other divide and conquer algorithms.

More information

Multi-Way Search Trees

Multi-Way Search Trees Multi-Way Search Trees Manolis Koubarakis 1 Multi-Way Search Trees Multi-way trees are trees such that each internal node can have many children. Let us assume that the entries we store in a search tree

More information

CS 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 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 information

(2,4) Trees. 2/22/2006 (2,4) Trees 1

(2,4) Trees. 2/22/2006 (2,4) Trees 1 (2,4) Trees 9 2 5 7 10 14 2/22/2006 (2,4) Trees 1 Outline and Reading Multi-way search tree ( 10.4.1) Definition Search (2,4) tree ( 10.4.2) Definition Search Insertion Deletion Comparison of dictionary

More information

Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 Merge Sort 2015 Goodrich and Tamassia Merge Sort 1 Application: Internet Search

More information

CS2223: 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 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 information

Line segment intersection. Family of intersection problems

Line segment intersection. Family of intersection problems CG Lecture 2 Line segment intersection Intersecting two line segments Line sweep algorithm Convex polygon intersection Boolean operations on polygons Subdivision overlay algorithm 1 Family of intersection

More information

Computational Geometry

Computational Geometry Windowing queries Windowing Windowing queries Zoom in; re-center and zoom in; select by outlining Windowing Windowing queries Windowing Windowing queries Given a set of n axis-parallel line segments, preprocess

More information

COMP3121/3821/9101/ s1 Assignment 1

COMP3121/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 information

The divide-and-conquer paradigm involves three steps at each level of the recursion: Divide the problem into a number of subproblems.

The divide-and-conquer paradigm involves three steps at each level of the recursion: Divide the problem into a number of subproblems. 2.3 Designing algorithms There are many ways to design algorithms. Insertion sort uses an incremental approach: having sorted the subarray A[1 j - 1], we insert the single element A[j] into its proper

More information

9 Bounds for the Knapsack Problem (March 6)

9 Bounds for the Knapsack Problem (March 6) 9 Bounds for the Knapsack Problem (March 6) In this lecture, I ll develop both upper and lower bounds in the linear decision tree model for the following version of the (NP-complete) Knapsack 1 problem:

More information

Lecture 3: Art Gallery Problems and Polygon Triangulation

Lecture 3: Art Gallery Problems and Polygon Triangulation EECS 396/496: Computational Geometry Fall 2017 Lecture 3: Art Gallery Problems and Polygon Triangulation Lecturer: Huck Bennett In this lecture, we study the problem of guarding an art gallery (specified

More information

Problem Set 5 Solutions

Problem Set 5 Solutions Introduction to Algorithms November 4, 2005 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik D. Demaine and Charles E. Leiserson Handout 21 Problem Set 5 Solutions Problem 5-1. Skip

More information

1/60. Geometric Algorithms. Lecture 1: Introduction. Convex Hulls

1/60. Geometric Algorithms. Lecture 1: Introduction. Convex Hulls 1/60 Geometric Algorithms Lecture 1: Introduction Convex Hulls Geometric algorithms scope 2/60 Geometry algorithms (practice): Study of geometric problems that arise in various applications and how algorithms

More information

Merge Sort Goodrich, Tamassia Merge Sort 1

Merge Sort Goodrich, Tamassia Merge Sort 1 Merge Sort 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 Merge Sort 1 Review of Sorting Selection-sort: Search: search through remaining unsorted elements for min Remove: remove

More information

DIVIDE AND CONQUER ALGORITHMS ANALYSIS WITH RECURRENCE EQUATIONS

DIVIDE 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 information

1 Minimum Cut Problem

1 Minimum Cut Problem CS 6 Lecture 6 Min Cut and Karger s Algorithm Scribes: Peng Hui How, Virginia Williams (05) Date: November 7, 07 Anthony Kim (06), Mary Wootters (07) Adapted from Virginia Williams lecture notes Minimum

More information

Computational Geometry

Computational Geometry Lecture 1: Introduction and convex hulls Geometry: points, lines,... Geometric objects Geometric relations Combinatorial complexity Computational geometry Plane (two-dimensional), R 2 Space (three-dimensional),

More information

Average case analysis of dynamic geometric optimization

Average case analysis of dynamic geometric optimization Average case analysis of dynamic geometric optimization David Eppstein Department of Information and Computer Science University of California, Irvine, CA 92717 May 19, 1995 Abstract We maintain the maximum

More information

Lecture Notes: Range Searching with Linear Space

Lecture Notes: Range Searching with Linear Space Lecture Notes: Range Searching with Linear Space Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong taoyf@cse.cuhk.edu.hk In this lecture, we will continue our discussion

More information

CSCE 411 Design and Analysis of Algorithms

CSCE 411 Design and Analysis of Algorithms CSCE 411 Design and Analysis of Algorithms Set 4: Transform and Conquer Slides by Prof. Jennifer Welch Spring 2014 CSCE 411, Spring 2014: Set 4 1 General Idea of Transform & Conquer 1. Transform the original

More information

1 The range query problem

1 The range query problem CS268: Geometric Algorithms Handout #12 Design and Analysis Original Handout #12 Stanford University Thursday, 19 May 1994 Original Lecture #12: Thursday, May 19, 1994 Topics: Range Searching with Partition

More information

Computational Geometry

Computational Geometry Motivation Motivation Polygons and visibility Visibility in polygons Triangulation Proof of the Art gallery theorem Two points in a simple polygon can see each other if their connecting line segment is

More information

A technique for adding range restrictions to. August 30, Abstract. In a generalized searching problem, a set S of n colored geometric objects

A technique for adding range restrictions to. August 30, Abstract. In a generalized searching problem, a set S of n colored geometric objects A technique for adding range restrictions to generalized searching problems Prosenjit Gupta Ravi Janardan y Michiel Smid z August 30, 1996 Abstract In a generalized searching problem, a set S of n colored

More information

Data Structures and Algorithms Week 4

Data Structures and Algorithms Week 4 Data Structures and Algorithms Week. About sorting algorithms. Heapsort Complete binary trees Heap data structure. Quicksort a popular algorithm very fast on average Previous Week Divide and conquer Merge

More information

Geometric Streaming Algorithms with a Sorting Primitive (TR CS )

Geometric Streaming Algorithms with a Sorting Primitive (TR CS ) Geometric Streaming Algorithms with a Sorting Primitive (TR CS-2007-17) Eric Y. Chen School of Computer Science University of Waterloo Waterloo, ON N2L 3G1, Canada, y28chen@cs.uwaterloo.ca Abstract. We

More information

Presentation 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, 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 information

CS 373: Combinatorial Algorithms, Spring 1999

CS 373: Combinatorial Algorithms, Spring 1999 CS 373: Combinatorial Algorithms, Spring 1999 Final Exam (May 7, 1999) Name: Net ID: Alias: This is a closed-book, closed-notes exam! If you brought anything with you besides writing instruments and your

More information

Notes in Computational Geometry Voronoi Diagrams

Notes in Computational Geometry Voronoi Diagrams Notes in Computational Geometry Voronoi Diagrams Prof. Sandeep Sen and Prof. Amit Kumar Indian Institute of Technology, Delhi Voronoi Diagrams In this lecture, we study Voronoi Diagrams, also known as

More information

Finger Search Trees with Constant Insertion Time. Gerth Stlting Brodal. Max-Planck-Institut fur Informatik. Im Stadtwald, D Saarbrucken, Germany

Finger Search Trees with Constant Insertion Time. Gerth Stlting Brodal. Max-Planck-Institut fur Informatik. Im Stadtwald, D Saarbrucken, Germany Finger Search Trees with Constant Insertion Time Gerth Stlting Brodal Max-Planck-Institut fur Informatik Im Stadtwald, D-66123 Saarbrucken, Germany Abstract We consider the problem of implementing nger

More information

We augment RBTs to support operations on dynamic sets of intervals A closed interval is an ordered pair of real

We augment RBTs to support operations on dynamic sets of intervals A closed interval is an ordered pair of real 14.3 Interval trees We augment RBTs to support operations on dynamic sets of intervals A closed interval is an ordered pair of real numbers ], with Interval ]represents the set Open and half-open intervals

More information

Finger Search Trees with Constant. Insertion Time. Gerth Stlting Brodal. Max-Planck-Institut fur Informatik. Im Stadtwald. D Saarbrucken

Finger Search Trees with Constant. Insertion Time. Gerth Stlting Brodal. Max-Planck-Institut fur Informatik. Im Stadtwald. D Saarbrucken Finger Search Trees with Constant Insertion Time Gerth Stlting Brodal Max-Planck-Institut fur Informatik Im Stadtwald D-66123 Saarbrucken Germany Email: brodal@mpi-sb.mpg.de September 26, 1997 Abstract

More information

Chapter 8. Voronoi Diagrams. 8.1 Post Oce Problem

Chapter 8. Voronoi Diagrams. 8.1 Post Oce Problem Chapter 8 Voronoi Diagrams 8.1 Post Oce Problem Suppose there are n post oces p 1,... p n in a city. Someone who is located at a position q within the city would like to know which post oce is closest

More information

SORTING, SETS, AND SELECTION

SORTING, 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 information

Parallel and Sequential Data Structures and Algorithms Lecture (Spring 2012) Lecture 16 Treaps; Augmented BSTs

Parallel and Sequential Data Structures and Algorithms Lecture (Spring 2012) Lecture 16 Treaps; Augmented BSTs Lecture 16 Treaps; Augmented BSTs Parallel and Sequential Data Structures and Algorithms, 15-210 (Spring 2012) Lectured by Margaret Reid-Miller 8 March 2012 Today: - More on Treaps - Ordered Sets and Tables

More information

Search Trees - 1 Venkatanatha Sarma Y

Search Trees - 1 Venkatanatha Sarma Y Search Trees - 1 Lecture delivered by: Venkatanatha Sarma Y Assistant Professor MSRSAS-Bangalore 11 Objectives To introduce, discuss and analyse the different ways to realise balanced Binary Search Trees

More information

Multi-Way Search Trees

Multi-Way Search Trees Multi-Way Search Trees Manolis Koubarakis 1 Multi-Way Search Trees Multi-way trees are trees such that each internal node can have many children. Let us assume that the entries we store in a search tree

More information

Data Structures and Algorithms Chapter 4

Data Structures and Algorithms Chapter 4 Data Structures and Algorithms Chapter. About sorting algorithms. Heapsort Complete binary trees Heap data structure. Quicksort a popular algorithm very fast on average Previous Chapter Divide and conquer

More information

We assume uniform hashing (UH):

We assume uniform hashing (UH): We assume uniform hashing (UH): the probe sequence of each key is equally likely to be any of the! permutations of 0,1,, 1 UH generalizes the notion of SUH that produces not just a single number, but a

More information

1 Divide and Conquer Approach

1 Divide and Conquer Approach Comp 163: Computational Geometry Tufts University, Spring 005 Professor Diane Souvaine Scribe: Katelyn Mann Dynamic Convex Hull and Order Decomposable Problems 1 Divide and Conquer Approach In order to

More information

Lecture 5: Sorting Part A

Lecture 5: Sorting Part A Lecture 5: Sorting Part A Heapsort Running time O(n lg n), like merge sort Sorts in place (as insertion sort), only constant number of array elements are stored outside the input array at any time Combines

More information

Prof. Gill Barequet. Center for Graphics and Geometric Computing, Technion. Dept. of Computer Science The Technion Haifa, Israel

Prof. Gill Barequet. Center for Graphics and Geometric Computing, Technion. Dept. of Computer Science The Technion Haifa, Israel Computational Geometry (CS 236719) http://www.cs.tufts.edu/~barequet/teaching/cg Chapter 1 Introduction 1 Copyright 2002-2009 2009 Prof. Gill Barequet Center for Graphics and Geometric Computing Dept.

More information

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture

More information

Figure 1: The three positions allowed for a label. A rectilinear map consists of n disjoint horizontal and vertical line segments. We want to give eac

Figure 1: The three positions allowed for a label. A rectilinear map consists of n disjoint horizontal and vertical line segments. We want to give eac Labeling a Rectilinear Map More Eciently Tycho Strijk Dept. of Computer Science Utrecht University tycho@cs.uu.nl Marc van Kreveld Dept. of Computer Science Utrecht University marc@cs.uu.nl Abstract Given

More information

Priority Queues. T. M. Murali. January 26, T. M. Murali January 26, 2016 Priority Queues

Priority Queues. T. M. Murali. January 26, T. M. Murali January 26, 2016 Priority Queues Priority Queues T. M. Murali January 26, 2016 Motivation: Sort a List of Numbers Sort INSTANCE: Nonempty list x 1, x 2,..., x n of integers. SOLUTION: A permutation y 1, y 2,..., y n of x 1, x 2,..., x

More information

Divide and Conquer. Algorithm Fall Semester

Divide and Conquer. Algorithm Fall Semester Divide and Conquer Algorithm 2014 Fall Semester Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances

More information

Lecture 3 February 9, 2010

Lecture 3 February 9, 2010 6.851: Advanced Data Structures Spring 2010 Dr. André Schulz Lecture 3 February 9, 2010 Scribe: Jacob Steinhardt and Greg Brockman 1 Overview In the last lecture we continued to study binary search trees

More information

vertices to be changed dynamically, two linear-space structures are known for general subdivisions: one by Cheng and Janardan [9] that answers queries

vertices to be changed dynamically, two linear-space structures are known for general subdivisions: one by Cheng and Janardan [9] that answers queries I/O-Ecient Dynamic Point Location in Monotone Planar Subdivisions (Extended Abstract) Pankaj K. Agarwal Lars Arge y Gerth Stlting rodal z Jerey S. Vitter x Abstract We present an ecient external-memory

More information

Algorithms and Complexity

Algorithms and Complexity Algorithms and Complexity Emanuele Viola March, 27 Copyright //27 present by Emanuele Viola Note: This text is in a preliminary state. Please send all bug reports and comments to (my five-letter last name)@ccs.neu.edu

More information

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Divide and Conquer

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Divide and Conquer Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Divide and Conquer Divide and-conquer is a very common and very powerful algorithm design technique. The general idea:

More information

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm Computing intersections in a set of line segments: the Bentley-Ottmann algorithm Michiel Smid October 14, 2003 1 Introduction In these notes, we introduce a powerful technique for solving geometric problems.

More information

Range Searching II: Windowing Queries

Range Searching II: Windowing Queries Computational Geometry Lecture : Windowing Queries INSTITUT FÜR THEORETISCHE INFORMATIK FAKULTÄT FÜR INFORMATIK Tamara Mchedlidze Chih-Hung Liu 23.11.2015 1 Object types in range queries y0 y x x0 Setting

More information

CS473 - Algorithms I

CS473 - Algorithms I CS473 - Algorithms I Lecture 4 The Divide-and-Conquer Design Paradigm View in slide-show mode 1 Reminder: Merge Sort Input array A sort this half sort this half Divide Conquer merge two sorted halves Combine

More information

Computing farthest neighbors on a convex polytope

Computing farthest neighbors on a convex polytope Theoretical Computer Science 296 (2003) 47 58 www.elsevier.com/locate/tcs Computing farthest neighbors on a convex polytope Otfried Cheong a;, Chan-Su Shin b, Antoine Vigneron c a Institute of Information

More information

CS 373: Combinatorial Algorithms, Fall Name: Net ID: Alias: U 3 / 4 1

CS 373: Combinatorial Algorithms, Fall Name: Net ID: Alias: U 3 / 4 1 CS 373: Combinatorial Algorithms, Fall 2000 Homework 1 (due November 16, 2000 at midnight) Starting with Homework 1, homeworks may be done in teams of up to three people. Each team turns in just one solution,

More information

Trees. Courtesy to Goodrich, Tamassia and Olga Veksler

Trees. Courtesy to Goodrich, Tamassia and Olga Veksler Lecture 12: BT Trees Courtesy to Goodrich, Tamassia and Olga Veksler Instructor: Yuzhen Xie Outline B-tree Special case of multiway search trees used when data must be stored on the disk, i.e. too large

More information

Ensures that no such path is more than twice as long as any other, so that the tree is approximately balanced

Ensures that no such path is more than twice as long as any other, so that the tree is approximately balanced 13 Red-Black Trees A red-black tree (RBT) is a BST with one extra bit of storage per node: color, either RED or BLACK Constraining the node colors on any path from the root to a leaf Ensures that no such

More information

Foundations of Computer Science Spring Mathematical Preliminaries

Foundations of Computer Science Spring Mathematical Preliminaries Foundations of Computer Science Spring 2017 Equivalence Relation, Recursive Definition, and Mathematical Induction Mathematical Preliminaries Mohammad Ashiqur Rahman Department of Computer Science College

More information

1 Maximum Independent Set

1 Maximum Independent Set CS 408 Embeddings and MIS Abhiram Ranade In this lecture we will see another application of graph embedding. We will see that certain problems (e.g. maximum independent set, MIS) can be solved fast for

More information

CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk

CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk 8/29/06 CS 6463: AT Computational Geometry 1 Convex Hull Problem Given a set of pins on a pinboard and a rubber band around them.

More information

Parallel 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 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 information

Solutions. (a) Claim: A d-ary tree of height h has at most 1 + d +...

Solutions. (a) Claim: A d-ary tree of height h has at most 1 + d +... Design and Analysis of Algorithms nd August, 016 Problem Sheet 1 Solutions Sushant Agarwal Solutions 1. A d-ary tree is a rooted tree in which each node has at most d children. Show that any d-ary tree

More information

Advanced Set Representation Methods

Advanced Set Representation Methods Advanced Set Representation Methods AVL trees. 2-3(-4) Trees. Union-Find Set ADT DSA - lecture 4 - T.U.Cluj-Napoca - M. Joldos 1 Advanced Set Representation. AVL Trees Problem with BSTs: worst case operation

More information

CPE702 Algorithm Analysis and Design Week 7 Algorithm Design Patterns

CPE702 Algorithm Analysis and Design Week 7 Algorithm Design Patterns CPE702 Algorithm Analysis and Design Week 7 Algorithm Design Patterns Pruet Boonma pruet@eng.cmu.ac.th Department of Computer Engineering Faculty of Engineering, Chiang Mai University Based on Slides by

More information

ICS 311, Fall 2017, Problem Set 04, Topics 7 & 8

ICS 311, Fall 2017, Problem Set 04, Topics 7 & 8 ICS 311, Fall 2017, Problem Set 04, Topics 7 & 8 Due by midnight Tuesday 2/16. 35 points. #1. Peer Credit Assignment 1 Point Extra Credit for replying Please list the names of the other members of your

More information

Reading for this lecture (Goodrich and Tamassia):

Reading for this lecture (Goodrich and Tamassia): COMP26120: Algorithms and Imperative Programming Basic sorting algorithms Ian Pratt-Hartmann Room KB2.38: email: ipratt@cs.man.ac.uk 2017 18 Reading for this lecture (Goodrich and Tamassia): Secs. 8.1,

More information

Computational Geometry

Computational Geometry Range searching and kd-trees 1 Database queries 1D range trees Databases Databases store records or objects Personnel database: Each employee has a name, id code, date of birth, function, salary, start

More information

Design and Analysis of Algorithms (VII)

Design and Analysis of Algorithms (VII) Design and Analysis of Algorithms (VII) An Introduction to Randomized Algorithms Guoqiang Li School of Software, Shanghai Jiao Tong University Randomized Algorithms algorithms which employ a degree of

More information

Lecture 13 Thursday, March 18, 2010

Lecture 13 Thursday, March 18, 2010 6.851: Advanced Data Structures Spring 2010 Lecture 13 Thursday, March 18, 2010 Prof. Erik Demaine Scribe: David Charlton 1 Overview This lecture covers two methods of decomposing trees into smaller subtrees:

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms CS245-2008S-19 B-Trees David Galles Department of Computer Science University of San Francisco 19-0: Indexing Operations: Add an element Remove an element Find an element,

More information

Trapezoid and Chain Methods

Trapezoid and Chain Methods C.S. 252 Prof. Roberto Tamassia Computational Geometry Sem. II, 1992 1993 Lecture 05 Date: Febuary 17, 1993 Scribe: Peter C. McCluskey Trapezoid and Chain Methods 1 Trapezoid Method (continued) Continuing

More information

Divide-and-Conquer. Divide-and conquer is a general algorithm design paradigm:

Divide-and-Conquer. Divide-and conquer is a general algorithm design paradigm: Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Merge Sort 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9

More information

CS301 - Data Structures Glossary By

CS301 - Data Structures Glossary By CS301 - Data Structures Glossary By Abstract Data Type : A set of data values and associated operations that are precisely specified independent of any particular implementation. Also known as ADT Algorithm

More information

Computational Geometry in the Parallel External Memory Model

Computational Geometry in the Parallel External Memory Model Computational Geometry in the Parallel External Memory Model Nodari Sitchinava Institute for Theoretical Informatics Karlsruhe Institute of Technology nodari@ira.uka.de 1 Introduction Continued advances

More information

January 10-12, NIT Surathkal Introduction to Graph and Geometric Algorithms

January 10-12, NIT Surathkal Introduction to Graph and Geometric Algorithms Geometric data structures Sudebkumar Prasant Pal Department of Computer Science and Engineering IIT Kharagpur, 721302. email: spp@cse.iitkgp.ernet.in January 10-12, 2012 - NIT Surathkal Introduction to

More information

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects Solid Modeling Thomas Funkhouser Princeton University C0S 426, Fall 2000 Solid Modeling Represent solid interiors of objects Surface may not be described explicitly Visible Human (National Library of Medicine)

More information

COMP Parallel Computing. PRAM (2) PRAM algorithm design techniques

COMP Parallel Computing. PRAM (2) PRAM algorithm design techniques COMP 633 - Parallel Computing Lecture 3 Aug 29, 2017 PRAM algorithm design techniques Reading for next class (Thu Aug 31): PRAM handout secns 3.6, 4.1, skim section 5. Written assignment 1 is posted, due

More information

PRAM Divide and Conquer Algorithms

PRAM Divide and Conquer Algorithms PRAM Divide and Conquer Algorithms (Chapter Five) Introduction: Really three fundamental operations: Divide is the partitioning process Conquer the the process of (eventually) solving the eventual base

More information

Orthogonal Range Search and its Relatives

Orthogonal Range Search and its Relatives Orthogonal Range Search and its Relatives Coordinate-wise dominance and minima Definition: dominates Say that point (x,y) dominates (x', y') if x

More information

Lecture 19 Sorting Goodrich, Tamassia

Lecture 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 information

V Advanced Data Structures

V Advanced Data Structures V Advanced Data Structures B-Trees Fibonacci Heaps 18 B-Trees B-trees are similar to RBTs, but they are better at minimizing disk I/O operations Many database systems use B-trees, or variants of them,

More information

CSC Design and Analysis of Algorithms

CSC Design and Analysis of Algorithms CSC 8301- Design and Analysis of Algorithms Lecture 6 Divide and Conquer Algorithm Design Technique Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide a problem instance into two

More information

Lecture 9: Sorting Algorithms

Lecture 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 information

FUTURE communication networks are expected to support

FUTURE communication networks are expected to support 1146 IEEE/ACM TRANSACTIONS ON NETWORKING, VOL 13, NO 5, OCTOBER 2005 A Scalable Approach to the Partition of QoS Requirements in Unicast and Multicast Ariel Orda, Senior Member, IEEE, and Alexander Sprintson,

More information

6. Algorithm Design Techniques

6. Algorithm Design Techniques 6. Algorithm Design Techniques 6. Algorithm Design Techniques 6.1 Greedy algorithms 6.2 Divide and conquer 6.3 Dynamic Programming 6.4 Randomized Algorithms 6.5 Backtracking Algorithms Malek Mouhoub, CS340

More information

CSC Design and Analysis of Algorithms. Lecture 6. Divide and Conquer Algorithm Design Technique. Divide-and-Conquer

CSC Design and Analysis of Algorithms. Lecture 6. Divide and Conquer Algorithm Design Technique. Divide-and-Conquer CSC 8301- Design and Analysis of Algorithms Lecture 6 Divide and Conquer Algorithm Design Technique Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide a problem instance into two

More information