31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 15<br />

Advanced Data Types for<br />

Two-Dimensional Geometry<br />

15.1 Two-Dimensional Dictionaries ( d2 dictionary )<br />

1. Definition<br />

An instance D of the parameterized data type d2 dictionary is a collection<br />

of items (dic2 item). Every item in D contains a key from the linearly ordered data type<br />

K1, a key from the linearly ordered data type K2, and an information from data type I.<br />

K1 and K2 are called the key types of D, and I is called the information type of D. If K1<br />

resp. K2 are user-defined types, you have to provide a compare function for type K1 resp.<br />

K2 (see Section 2.3). <strong>The</strong> number of items in D is called the size of D. A two-dimensional<br />

dictionary of size zero is said to be empty. We use to denote the item with<br />

first key k 1 , second key k 2 , and information i. For each pair (k 1 , k 2 ) ∈ K1 × K2 there is<br />

at most one item ∈ D. Additionally to the normal dictionary operations, the<br />

data type d2 dictionary supports rectangular range queries on K1 × K2.<br />

#include < <strong>LEDA</strong>/geo/d2 dictionary.h ><br />

2. Creation<br />

d2 dictionary D;<br />

creates an instance D of type d2 dictionary and initializes<br />

D to the empty dictionary.<br />

3. Operations<br />

const K1 & D.key1(dic2 item it) returns the first key of item it.<br />

Precondition: it is an item in D.<br />

const K2 & D.key2(dic2 item it) returns the second key of item it.<br />

Precondition: it is an item in D.<br />

539

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!