Java Reference
In-Depth Information
1
Data Structures and Algorithms
How many cities with more than 250,000 people lie within 500 miles of Dallas,
Texas? How many people in my company make over $100,000 per year? Can we
connect all of our telephone customers with less than 1,000 miles of cable? To
answer questions like these, it is not enough to have the necessary information. We
must organize that information in a way that allows us to find the answers in time
to satisfy our needs.
Representing information is fundamental to computer science. The primary
purpose of most computer programs is not to perform calculations, but to store and
retrieve information — usually as fast as possible. For this reason, the study of
data structures and the algorithms that manipulate them is at the heart of computer
science. And that is what this topic is about — helping you to understand how to
structure information to support efficient processing.
This topic has three primary goals. The first is to present the commonly used
data structures.
These form a programmer's basic data structure “toolkit.”
For
many problems, some data structure in the toolkit provides a good solution.
The second goal is to introduce the idea of tradeoffs and reinforce the concept
that there are costs and benefits associated with every data structure. This is done
by describing, for each data structure, the amount of space and time required for
typical operations.
The third goal is to teach how to measure the effectiveness of a data structure or
algorithm. Only through such measurement can you determine which data structure
in your toolkit is most appropriate for a new problem. The techniques presented
also allow you to judge the merits of new data structures that you or others might
invent.
There are often many approaches to solving a problem. How do we choose
between them? At the heart of computer program design are two (sometimes con-
flicting) goals:
1. To design an algorithm that is easy to understand, code, and debug.
2. To design an algorithm that makes efficient use of the computer's resources.
3
 
Search WWH ::




Custom Search