23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

9.3 The Dictionary Abstract <strong>Data</strong> Type<br />

Like a map, a dictionary stores key-value pairs (k, v), which we call entries, where k<br />

is the key <strong>and</strong> v is the value. Similarly, a dictionary allows for keys <strong>and</strong> values to be<br />

of any object type. But, whereas a map <strong>in</strong>sists that entries have unique keys, a<br />

dictionary allows for multiple entries to have the same key, much like an English<br />

dictionary, which allows for multiple def<strong>in</strong>itions for the same word.<br />

We dist<strong>in</strong>guish two types of dictionaries, unordered dictionaries <strong>and</strong> ordered<br />

dictionaries. In an ordered dictionary, we assume that a total order relation is de f<strong>in</strong>ed<br />

544

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

Saved successfully!

Ooh no, something went wrong!