Vous êtes sur la page 1sur 1

Data Types and Data Structures

by: David Harel

So we now know what an algorithm looks like and how, given inputs, the processor
runs around executing the process the algorithm describes. However, we have been
quite vague as to the objects manipulated by an algorithm.We had lists, words, and
texts, as well as funny things like “noted numbers” that increased, and “pointers” that
made progress. If we wish to go to extremes, we can also say we had flour, sugar,
cakes, and chocolate mousse, as well as towers, pegs, and rings. These objects
constituted not only the algorithm’s inputs and outputs, but also intermediate
accessories that were constructed and used during its lifetime, such as the counters
(“noted numbers”) and the pointers. For all of these we use the generic term data. Data
elements come in various flavors, or can be of various types. Some of the most
common data types present in algorithms that are executed by computers are numbers
of various kinds (integers, decimals, binary numbers, and so on), and words written in
various alphabets. Actually, numbers can be construed as words too; decimal integers,
for example, are “words” over an alphabet consisting of the digits 0, 1, 2,..., 9, and
binary numbers use the alphabet consisting of 0 and 1 only.It is beneficial, however, to
keep such types separate, not only for clarity and good order, but also because each
type admits its own special set of allowed operations, or actions. It makes no more
sense to list the vowels in a number than it does to

multiply two words! And so, our algorithms will have to be told what objects they can
manipulate and precisely which manipulations are allowed. Manipulation includes not
only carrying out operations but also asking questions, such as testing whether a
number is even or whether two words start with the same letter. These observations
seem quite natural in view of our discussion of elementary operations in Chapter 1, and
are reminiscent of the facts about the bit-manipulation capabilities of computers. Here
we take basic data types and the operations and tests associated with them for
granted. What we are interested in are the ways

algorithms can organize, remember, change, and access collections of data. While
control structures serve to tell the processorwhere it should be going, data structures,
and the operations upon them, organize the data items in ways that enable it to do
whatever it should do when it gets there. The world of data structures is just as rich in
abstraction levels as the world of control structures. In fact, a useful mental trick, which
is the basis for the object-

oriented programming paradigm, shows that we can switch between them! This will be
discussed further in Chapter 3.

Reference: Algorithmics spirit of computing

Date: 26-08-2008

Vous aimerez peut-être aussi