Priority Search Trees Keys are distinct ordered pairs (x i, y i ). Basic operations.  get(x,y) … return element whose key is (x,y).  delete(x,y) … delete.

Slides:



Advertisements
Similar presentations
Router/Classifier/Firewall Tables Set of rules—(F,A)  F is a filter Source and destination addresses. Port number and protocol. Time of day.  A is an.
Advertisements

Internet Routers
B+-Trees (PART 1) What is a B+ tree? Why B+ trees? Searching a B+ tree
Dictionaries Collection of items. Each item is a pair.  (key, element)  Pairs have different keys.
Rapid Global Alignments How to align genomic sequences in (more or less) linear time.
Tries Standard Tries Compressed Tries Suffix Tries.
Digital Search Trees & Binary Tries Analog of radix sort to searching. Keys are binary bit strings.  Fixed length – 0110, 0010, 1010,  Variable.
9/5/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Plane Sweep Algorithms and Segment Intersection Carola Wenk.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Convex Hulls Today: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness,
Advanced Topics in Algorithms and Data Structures Page 1 Parallel merging through partitioning The partitioning strategy consists of: Breaking up the given.
I/O-Algorithms Lars Arge Aarhus University February 27, 2007.
Efficient Algorithmic Techniques for Several Multidimensional Geometric Data Management and Analysis Problems Mugurel Ionut Andreica Politehnica University.
IP Address Lookup for Internet Routers Using Balanced Binary Search with Prefix Vector Author: Hyesook Lim, Hyeong-gee Kim, Changhoon Publisher: IEEE TRANSACTIONS.
I/O-Algorithms Lars Arge University of Aarhus March 1, 2005.
Parallel Merging Advanced Algorithms & Data Structures Lecture Theme 15 Prof. Dr. Th. Ottmann Summer Semester 2006.
1 Geometric Solutions for the IP-Lookup and Packet Classification Problem (Lecture 12: The IP-LookUp & Packet Classification Problem, Part II) Advanced.
FALL 2004CENG 3511 Hashing Reference: Chapters: 11,12.
Geometric Data Structures Computational Geometry, WS 2007/08 Lecture 13 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
I/O-Algorithms Lars Arge Aarhus University March 5, 2008.
Lecture 11 : More Geometric Data Structures Computational Geometry Prof. Dr. Th. Ottmann 1 Geometric Data Structures 1.Rectangle Intersection 2.Segment.
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.
1 Hash Tables  a hash table is an array of size Tsize  has index positions 0.. Tsize-1  two types of hash tables  open hash table  array element type.
External Memory Algorithms for Geometric Problems Piotr Indyk (slides partially by Lars Arge and Jeff Vitter)
Bin Yao Spring 2014 (Slides were made available by Feifei Li) Advanced Topics in Data Management.
Sorting with Heaps Observation: Removal of the largest item from a heap can be performed in O(log n) time Another observation: Nodes are removed in order.
Objective: Plot points and lines on a coordinate plane. Standards Addressed: G: Represent relationships with tables or graphs in the coordinate plane.
Lars Arge Presented by Or Ozery. I/O Model Previously defined: N = # of elements in input M = # of elements that fit into memory B = # of elements per.
Lecture 2: External Memory Indexing Structures CS6931 Database Seminar.
Bin Yao (Slides made available by Feifei Li) R-tree: Indexing Structure for Data in Multi- dimensional Space.
Segment Trees Basic data structure in computational geometry. Computational geometry.  Computations with geometric objects.  Points in 1-, 2-, 3-, d-space.
CMPS 3130/6130 Computational Geometry Spring 2015
Data Structures for Midterm 2. C++ Data Structure Runtimes.
S. Raskhodnikova and A. Smith. Based on slides by C. Leiserson and E. Demaine. 1 Adam Smith L ECTURES Priority Queues and Binary Heaps Algorithms.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
Priority Search Trees Keys are pairs (x,y). Basic (search, insert, delete) and rectangle operations. Two varieties.  Based on a balanced binary search.
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
Dictionaries Collection of items. Each item is a pair. (key, element)
Set Collection A Bag is a general collection class that implements the Collection interface. A Set is a collection that resembles a Bag with the provision.
Chapter 11 Heap.
Heaps (8.3) CSE 2011 Winter May 2018.
Top 50 Data Structures Interview Questions
Indexing Goals: Store large files Support multiple search keys
Priority Queues An abstract data type (ADT) Similar to a queue
AN ON-CHIP IP ADDRESS LOOKUP ALGORITHM
Hashing CENG 351.
Best-fit bin packing in O(n log n) time
Week 11 - Friday CS221.
Heaps © 2010 Goodrich, Tamassia Heaps Heaps
Dynamic Dictionaries Primary Operations: Additional operations:
Digital Search Trees & Binary Tries
Priority Queues Linked-list Insert Æ Æ head head
CMPS 3130/6130 Computational Geometry Spring 2017
ADT Heap data structure
Interval Heaps Complete binary tree.
Advanced Topics in Data Management
Priority Search Trees Keys are pairs (x,y).
CSE 373: Data Structures and Algorithms
Segment Trees Basic data structure in computational geometry.
Tree Representation Heap.
Hassan Khosravi / Geoffrey Tien
Priority Search Trees Modified Prof. Sahni’s notes.
Chapter 6: Transform and Conquer
Digital Search Trees & Binary Tries
Binary Trees, Binary Search Trees
Priority Queues An abstract data type (ADT) Similar to a queue
Heaps © 2014 Goodrich, Tamassia, Goldwasser Heaps Heaps
Dynamic rectangular intersection with priorities
Binary Trees, Binary Search Trees
Dynamic rectangular intersection with priorities
Presentation transcript:

Priority Search Trees Keys are distinct ordered pairs (x i, y i ). Basic operations.  get(x,y) … return element whose key is (x,y).  delete(x,y) … delete and return element whose key is (x,y).  insert(x,y,e) … insert element e, whose key is (x,y). Rectangle operations.

minXinRectangle(x L,x R,y T ) Return element with min x-coordinate in the rectangle defined by the lines, x= x L, x= x R, y = 0, y = y T, x L <= x R, 0 <= y T. I.e., return element with min x such that x L <= x <= x R and 0 <= y <= y T. xLxL xRxR yTyT

maxXinRectangle(x L,x R,y T ) Return element with max x-coordinate in the rectangle defined by the lines, x= x L, x= x R, y = 0, y = y T, x L <= x R, 0 <= y T. I.e., return element with max x such that x L <= x <= x R and 0 <= y <= y T. xLxL xRxR yTyT

minYinXrange(x L,x R ) Return element with min y-coordinate in the rectangle defined by the lines, x= x L, x= x R, y = 0, y = infinity, x L <= x R. I.e., return element with min y such that x L <= x <= x R. xLxL xRxR

enumerateRectangle(x L,x R,y T ) Return all elements in the rectangle defined by the lines, x= x L, x= x R, y = 0, y = y T, x L <= x R, 0 <= y T. I.e., return all elements such that x L <= x <= x R and 0 <= y <= y T. xLxL xRxR yTyT

Complexity O(log n) for each operation except for enumerateRectangle, where n is the number of elements in the tree. Complexity of enumerateRectangle is O(log n + s), where s is the number of elements in the rectangle.

Applications – Visibility Dynamic set of semi-infinite vertical line segments.  Vertical lines with end points (x i,infinity) and (x i,y i ). (2,1) (3,4) (4,2) (5,6) (6,3) Opaque/translucent lines.

Translucent Lines Eye is at (x,y). Priority search tree of line end points. enumerateRectangle(x, infinity, y). (2,1) (3,4) (4,2) (5,6) (6,3) 0 y x infinity

Opaque Lines Eye is at (x,y). Priority search tree of line end points. minXinRectangle(x, infinity, y). (2,1) (3,4) (4,2) (5,6) (6,3) 0 y x infinity

Bin Packing First fit. Best fit. Combination.  Some items packed using first fit.  Others packed using best fit. Memory allocation.

Combined First And Best Fit Bins are numbered 0, 1, …, n – 1. Capacity of each is c. Initialize priority search tree with the pairs (c, j), 0 <= j < n.

First Fit minYinXrange(neededSize, infinity) bin index available capacity neededSize

Best Fit minXinRectangle(neededSize, infinity, infinity) bin index available capacity neededSize

Online Intersection Of Linear Intervals Intervals are of the form [i,j], i < j. [i,j] may, for example represent the fact that a machine is busy from time i to time j. Answer queries of the form: which intervals intersect/overlap with a given interval [u,v], u < v.  List all machines that are busy at any time between u and v.

Example Machine a is busy from time 1 to time 3. Interval is [1,3]. Machines a, b, c, e, and f are busy at some time in the interval [2,4]. 1 e 13 a 24 c 46 b 36 f 57 d 2

Example Interval [i,j] corresponds to the pair (x,y), where x = j and y = i. 1 e 13 a 24 c 46 b 36 f 57 d 2 ae f b c d enumerateRectangle(u, infinity, v). enumerateRectangle(2, infinity, 4).

Compare With Segment Tree Min and max interval end points must be known in advance to define the root range of the segment tree. Search interval size is 1. Must break larger search intervals into unit intervals and remove duplicate responses.

Interval Containment List all intervals [i,j] that contain the interval [u,v].  [i,j] contains [u,v] iff i <= u <= v <= j. 1 e 13 a 24 c 46 b 36 f 57 d 2 [u,v] = [5,6]

Interval Containment Interval [i,j] corresponds to the pair (x,y), where x = j and y = i. 1 e 13 a 24 c 46 b 36 f 57 d 2 ae f b c d enumerateRectangle(v, infinity, u). enumerateRectangle(6, infinity, 5).

Intersecting Rectangle Pairs (A,B), (A,C), (D, G), (E,F) Online interval intersection. A F C D E B G

Algorithm Examine horizontal edges in sorted y order.  Bottom edge => insert interval into a priority search tree.  Top edge => report intersecting segments and delete the top edge’s corresponding bottom edge. A F C D E B G

Complexity Examine edges in sorted order.  Bottom edge => insert interval into a priority search tree.  Top edge => report intersecting segments and delete the top edge’s corresponding bottom edge. O(n log n) to sort edges by y, where n is # of rectangles.  Insert n intervals … O(n log n).  Report intersecting segments … O(n log n + s).  Delete n intervals … O(n log n).

IP Router Table Longest-prefix matching  10*, 101*, 1001*  Destination address d =  Longest matching-prefix is 101* Prefix is an interval  d is 5 bits => 101* = [10100, 10111] = [20,23] 2 prefixes may nest but may not have a proper intersection

IP Router Table p(d) = prefixes that match d. Use online interval intersection mapping. p(d) = enumerateRectangle(d,infinity,d) d

IP Router Table lmp(d) = [maxStart(p(d)), minFinish(p(d))] minXinRectangle(d,infinity,d) finds lmp(d) except when >1 prefixes have same finish point. d

IP Router Table Remap finish points so that all prefixes have different finish point. f’ = 2 w f – s + 2 w – 1, w = length of d f’ is smaller when s is bigger d

IP Router Table Complexity is O(log n) for insert, delete, and find longest matching-prefix. d