Java Reference
In-Depth Information
Ideally, the resulting program is true to both of these goals. We might say that
such a program is “elegant.” While the algorithms and program code examples pre-
sented here attempt to be elegant in this sense, it is not the purpose of this topic to
explicitly treat issues related to goal (1). These are primarily concerns of the disci-
pline of Software Engineering. Rather, this topic is mostly about issues relating to
goal (2).
How do we measure efficiency? Chapter 3 describes a method for evaluating
the efficiency of an algorithm or computer program, called asymptotic analysis.
Asymptotic analysis also allows you to measure the inherent difficulty of a problem.
The remaining chapters use asymptotic analysis techniques to estimate the time cost
for every algorithm presented. This allows you to see how each algorithm compares
to other algorithms for solving the same problem in terms of its efficiency.
This first chapter sets the stage for what is to follow, by presenting some higher-
order issues related to the selection and use of data structures. We first examine the
process by which a designer selects a data structure appropriate to the task at hand.
We then consider the role of abstraction in program design. We briefly consider
the concept of a design pattern and see some examples. The chapter ends with an
exploration of the relationship between problems, algorithms, and programs.
1.1
A Philosophy of Data Structures
1.1.1
The Need for Data Structures
You might think that with ever more powerful computers, program efficiency is
becoming less important. After all, processor speed and memory size still con-
tinue to improve. Won't any efficiency problem we might have today be solved by
tomorrow's hardware?
As we develop more powerful computers, our history so far has always been to
use that additional computing power to tackle more complex problems, be it in the
form of more sophisticated user interfaces, bigger problem sizes, or new problems
previously deemed computationally infeasible. More complex problems demand
more computation, making the need for efficient programs even greater. Worse yet,
as tasks become more complex, they become less like our everyday experience.
Today's computer scientists must be trained to have a thorough understanding of the
principles behind efficient program design, because their ordinary life experiences
often do not apply when designing computer programs.
In the most general sense, a data structure is any data representation and its
associated operations. Even an integer or floating point number stored on the com-
puter can be viewed as a simple data structure. More commonly, people use the
term “data structure” to mean an organization or structuring for a collection of data
items. A sorted list of integers stored in an array is an example of such a structuring.
Search WWH ::




Custom Search