Fractional Cascading and Its Applications G. S. Lueker. A data structure for orthogonal range queries. In Proc. 19 th annu. IEEE Sympos. Found. Comput.

Slides:



Advertisements
Similar presentations
Introduction to Algorithms
Advertisements

Orthogonal range searching. The problem (1-D) Given a set of points S on the line, preprocess them to build structure that allows efficient queries of.
Heaps1 Part-D2 Heaps Heaps2 Recall Priority Queue ADT (§ 7.1.3) A priority queue stores a collection of entries Each entry is a pair (key, value)
CS Divide and Conquer/Recurrence Relations1 Divide and Conquer.
Lecture 3: Parallel Algorithm Design
AVL Trees COL 106 Amit Kumar Shweta Agrawal Slide Courtesy : Douglas Wilhelm Harder, MMath, UWaterloo
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
Dynamic Planar Convex Hull Operations in Near- Logarithmic Amortized Time TIMOTHY M. CHAN.
COSC 6114 Prof. Andy Mirzaian. References: [M. de Berge et al] chapter 5 Applications: Data Base GIS, Graphics: crop-&-zoom, windowing.
9/12/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries II Carola Wenk.
© The McGraw-Hill Companies, Inc., Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Lectures on Recursive Algorithms1 COMP 523: Advanced Algorithmic Techniques Lecturer: Dariusz Kowalski.
Introduction to Algorithms Rabie A. Ramadan rabieramadan.org 6 Ack : Carola Wenk nad Dr. Thomas Ottmann tutorials.
Advanced Databases: Lecture 2 Query Optimization (I) 1 Query Optimization (introduction to query processing) Advanced Databases By Dr. Akhtar Ali.
Zoo-Keeper’s Problem An O(nlogn) algorithm for the zoo-keeper’s problem Sergei Bespamyatnikh Computational Geometry 24 (2003), pp th CGC Workshop.
Constant-Time LCA Retrieval
Fractional Cascading CSE What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.
Orthogonal Range Searching 3Computational Geometry Prof. Dr. Th. Ottmann 1 Orthogonal Range Searching 1.Linear Range Search : 1-dim Range Trees 2.2-dimensional.
I/O-Algorithms Lars Arge Aarhus University February 27, 2007.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Chapter 4: Divide and Conquer The Design and Analysis of Algorithms.
Orthogonal Range Searching Computational Geometry, WS 2006/07 Lecture 13 – Part III Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
I/O-Algorithms Lars Arge University of Aarhus March 1, 2005.
I/O-Algorithms Lars Arge Spring 2009 March 3, 2009.
B + -Trees (Part 1) Lecture 20 COMP171 Fall 2006.
B + -Trees (Part 1). Motivation AVL tree with N nodes is an excellent data structure for searching, indexing, etc. –The Big-Oh analysis shows most operations.
Tirgul 6 B-Trees – Another kind of balanced trees Problem set 1 - some solutions.
B + -Trees (Part 1) COMP171. Slide 2 Main and secondary memories  Secondary storage device is much, much slower than the main RAM  Pages and blocks.
The Complexity of Algorithms and the Lower Bounds of Problems
Homework #3 Due Thursday, April 17 Problems: –Chapter 11: 11.6, –Chapter 12: 12.1, 12.2, 12.3, 12.4, 12.5, 12.7.
AALG, lecture 11, © Simonas Šaltenis, Range Searching in 2D Main goals of the lecture: to understand and to be able to analyze the kd-trees and.
Orthogonal Range Searching I Range Trees. Range Searching S = set of geometric objects Q = query object Report/Count objects in S that intersect Q Query.
1 Geometric Intersection Determining if there are intersections between graphical objects Finding all intersecting pairs Brute Force Algorithm Plane Sweep.
Chapter Tow Search Trees BY HUSSEIN SALIM QASIM WESAM HRBI FADHEEL CS 6310 ADVANCE DATA STRUCTURE AND ALGORITHM DR. ELISE DE DONCKER 1.
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
1 B Trees - Motivation Recall our discussion on AVL-trees –The maximum height of an AVL-tree with n-nodes is log 2 (n) since the branching factor (degree,
UNC Chapel Hill M. C. Lin Orthogonal Range Searching Reading: Chapter 5 of the Textbook Driving Applications –Querying a Database Related Application –Crystal.
Fractional Cascading Fractional Cascading I: A Data Structuring Technique Fractional Cascading II: Applications [Chazaelle & Guibas 1986] Dynamic Fractional.
14/13/15 CMPS 3130/6130 Computational Geometry Spring 2015 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry.
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
The Lower Bounds of Problems
Mehdi Mohammadi March Western Michigan University Department of Computer Science CS Advanced Data Structure.
B + -Trees. Motivation An AVL tree with N nodes is an excellent data structure for searching, indexing, etc. The Big-Oh analysis shows that most operations.
2IL50 Data Structures Fall 2015 Lecture 9: Range Searching.
1 Trees 4: AVL Trees Section 4.4. Motivation When building a binary search tree, what type of trees would we like? Example: 3, 5, 8, 20, 18, 13, 22 2.
Orthogonal Range Search
1 Searching the dictionary ADT binary search binary search trees.
Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function.
Marwan Al-Namari Hassan Al-Mathami. Indexing What is Indexing? Indexing is a mechanisms. Why we need to use Indexing? We used indexing to speed up access.
CMPS 3130/6130 Computational Geometry Spring 2015
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
Polygon Triangulation
CSE 589 Applied Algorithms Spring 1999 Prim’s Algorithm for MST Load Balance Spanning Tree Hamiltonian Path.
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
May 2012Range Search Algorithms1 Shmuel Wimer Bar Ilan Univ. Eng. Faculty Technion, EE Faculty.
CSE 554 Lecture 5: Contouring (faster)
Lecture 3: Parallel Algorithm Design
Geometric Data Structures
CMPS 3130/6130 Computational Geometry Spring 2017
Segment tree and Interval Tree
Orthogonal Range Searching and Kd-Trees
Computational Geometry Capter:1-2.1
Reporting (1-D) Given a set of points S on the line, preprocess them to build structure that allows efficient queries of the from: Given an interval I=[x1,x2]
Binary Search Trees.
Shmuel Wimer Bar Ilan Univ., School of Engineering
Approximating Points by A Piecewise Linear Function: I
CMPS 3130/6130 Computational Geometry Spring 2017
CSC 143 Binary Search Trees.
CMPS 3130/6130 Computational Geometry Spring 2017
Presentation transcript:

Fractional Cascading and Its Applications G. S. Lueker. A data structure for orthogonal range queries. In Proc. 19 th annu. IEEE Sympos. Found. Comput. Sci., pages 28-34, D. E. Willard. Predicate-oriented database search algorithms. Ph.D. thesis, Aiken Comput. Lab., Harvard Univ., Cambridge, MA, 1978, Report TR B. Chazelle, L. J. Guibas: Fractional Cascading: I. A Data Structuring Technique. Algorithmica 1(2): (1986) B. Chazelle, L. J. Guibas: Fractional Cascading: II. Applications. Algorithmica 1(2): (1986) Slides by Dror Aiger

What is Fractional Cascading? A technique to speed up a sequence of binary searches for the same value in a sequence of related data structures. The first binary search in the sequence takes a logarithmic time, but successive searches in the sequence are faster.

A simple example Let A 1 and A 2 be two sorted arrays of real numbers. Problem: report all numbers of A 1 and A 2 in the range [y,y’]. Solution: binary search for first number ≥ y in A 1, traverse until number is ≥ y’. Same for A 2. Query time: O(k) + two binary searches. What if numbers in A 2 are a subset of A 1 ?

Adding pointers We add pointers from the entries in A 1 to the entries in A 2 (in the preprocess stage). Binary search for first number ≥ y in A 1. Store pointer from that number to array A 2. Traverse A 1 until number is ≥ y’. Traverse A 2 from pointer until number is ≥ y’. Query time: one binary search on A 1, plus reporting k numbers.

Adding pointers - example

Application in Range Searching In the plane the query time of range trees is O(log 2 (n)+k). Can we do better? Yes, we can obtain O(log(n)+k) query time with fractional cascading.

A reminder: a range tree

A reminder: Canonical sets We store the points in the set P in a balanced binary tree T, using the x–coordinates as keys. Each node v of T is associated with a canonical set P(v), which is the set of all the points in P that are stored in the sub tree rooted at v:

The idea When processing a query [x:x’] x [y,y’], we search some trees with the same keys. For each such tree we spend O(log(n)) time in standard range tree. P(lc(v)) and P(rc(v)) are subsets of P(v). We will keep pointers between nodes of T(v) and nodes of lc(v) and rc(v) that keep the same key, or the next smallest key. After performing a search in T(v) this will allow to perform a search in lc(v) and rc(v) in O(1) time.

The data structure Each canonical subset P(v) is stored in an array A(v). Each entry of A(v) stores two pointers: –A pointer into A(lc(v)) and a pointer into A(rc(v)). –Let A(v)[i] stores a point p - we store a pointer from A(v)[i] to the entry of A(lc(v)) such that the y-coordinate of the point stored there is the smallest one larger than or equal to p y.

Layered range tree example

Query We search with x and x’ in the main tree T to determine O(log(n)) nodes whose canonical subsets together contain the points with x- coordinate in [x:x’]. Let the path splits at v – we find the entry in A(v) whose y-coordinate is the smallest one larger than or equal to y (O(log(n) with binary search). While we search further with x and x’ in the main tree we keep track of the entry in the associated arrays. They can be maintained in constant time by following the pointers. If v is one of the O(log(n)) nodes we selected, we have to report the points stored in A(v) whose y-coordinate is in [y:y’] and this is done in O(1+k v ) by walking through the array, where k v is the number of points reported at v. The total time now becomes O(log(n)+k)

Consequences By induction, it also improves by a factor of O(log(n)) the results in d > 2. Range trees with fractional cascading in d ≥ 2 yield query time: O(k + log d−1 (n)). Space usage: O(n log d−1 n). Preprocessing time: O(n log d−1 (n)). In d = 2, the query time and preprocessing time are optimal, but space usage is not.

Another application Intersecting a polygonal path with a line CG86 Bernard Chazelle, Leonidas J. Guibas: Fractional Cascading: II. Applications. Algorithmica 1(2): (1986)

Intersecting a polygonal path with a line We are given a polygonal path P and we wish to preprocess it into a data structure so that given any query line l, we can quickly report all the intersections of P and l. The idea is based on recursive application of the following: –A straight line l intersects a polygonal line P if and only if it intersects the convex hull of P. The convex hulls is computed (recursively) in the preprocess stage. In each step we compute the CH of the first and second halves of the current polyline (F(P) and S(P)) – This takes O(n log(n)) time and space. We have a balanced binary tree T:

Query The query is simple:

Intersecting a polygonal path with a line This still gives Ω(log 2 n) query time since we need logarithmic time for each convex hull and we have at least log(n) such operations: We need some tools to be able to use fractional cascading: –Slope Sequence of convex polygon C is a (unique) circular permutation of the edges of C such that the slopes are non decreasing (it is well known that it exists). –Finding intersection can be done in constant time in this sequence if we know the positions of the slopes of l. –We view each node x, of T as containing the slope sequence of the convex polygon associated with x and apply fractional cascading to these structures. –Any time we need to decide whether to descent to a subtree, we look up the slopes of l in that subtree root’s sequence and find the answer in constant time (we still have the logarithmic time for the root of T).

Intersecting a polygonal path with a line We thus get O(log n + size of the subtree of T actually visited) query time. This can be shown [CG86] to be O((k+1)log(n/(k+1))) where k is the number of intersections. The size and preprocessing time of the structure is O(nlog(n)):