The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998 The.Algorithm.Design.Manual.Springer-Verlag.1998

18.04.2013 Views

Data Structures ● Priority Queues ● Suffix Trees and Arrays ● Graph Data Structures ● Set Data Structures ● Kd-Trees Next: Dictionaries Up: A Catalog of Algorithmic Previous: Caveats Algorithms Mon Jun 2 23:33:50 EDT 1997 file:///E|/BOOK/BOOK3/NODE128.HTM (2 of 2) [19/1/2003 1:30:01]

Dictionaries Next: Priority Queues Up: Data Structures Previous: Data Structures Dictionaries Input description: A set of n records, each identified by one or more key fields. Problem description: Build and maintain a data structure to efficiently locate, insert, or delete the record associated with any query key q. Discussion: The abstract data type ``dictionary'' is one of the most important structures in computer science. Dozens of different data structures have been proposed for implementing dictionaries including hash tables, skip lists, and balanced/unbalanced binary search trees - so choosing the right one can be tricky. Depending on the application, it is also a decision that can significantly impact performance. In practice, it is more important to avoid using a bad data structure than to identify the single best option available. An essential piece of advice is to carefully isolate the implementation of the dictionary data structure from its interface. Use explicit calls to subroutines that initialize, search, and modify the data structure, rather than embedding them within the code. This leads to a much cleaner program, but it also makes it easy to try different dictionary implementations to see how they impact performance. Do not obsess about the cost of the procedure call overhead inherent in such an abstraction. If your application is so time-critical that such overhead can impact performance, then it is even more essential that you be able to file:///E|/BOOK/BOOK3/NODE129.HTM (1 of 5) [19/1/2003 1:30:03]

Dictionaries<br />

Next: Priority Queues Up: Data Structures Previous: Data Structures<br />

Dictionaries<br />

Input description: A set of n records, each identified by one or more key fields.<br />

Problem description: Build and maintain a data structure to efficiently locate, insert, or delete the record<br />

associated with any query key q.<br />

Discussion: <strong>The</strong> abstract data type ``dictionary'' is one of the most important structures in computer<br />

science. Dozens of different data structures have been proposed for implementing dictionaries including<br />

hash tables, skip lists, and balanced/unbalanced binary search trees - so choosing the right one can be<br />

tricky. Depending on the application, it is also a decision that can significantly impact performance. In<br />

practice, it is more important to avoid using a bad data structure than to identify the single best option<br />

available.<br />

An essential piece of advice is to carefully isolate the implementation of the dictionary data structure<br />

from its interface. Use explicit calls to subroutines that initialize, search, and modify the data structure,<br />

rather than embedding them within the code. This leads to a much cleaner program, but it also makes it<br />

easy to try different dictionary implementations to see how they impact performance. Do not obsess<br />

about the cost of the procedure call overhead inherent in such an abstraction. If your application is so<br />

time-critical that such overhead can impact performance, then it is even more essential that you be able to<br />

file:///E|/BOOK/BOOK3/NODE129.HTM (1 of 5) [19/1/2003 1:30:03]

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

Saved successfully!

Ooh no, something went wrong!