13.12.2012 Views

Theoretical and Experimental DNA Computation (Natural ...

Theoretical and Experimental DNA Computation (Natural ...

Theoretical and Experimental DNA Computation (Natural ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

JUMP while<br />

endwhile: WRITE 2 write power<br />

end: HALT<br />

2.5 Data Structures 33<br />

The description of the structure of the RAM <strong>and</strong> its instruction set constitutes<br />

the machine model or model of computation. Thisisaformal,abstract<br />

definition of a computer. Using a model of computation allows us to calculate<br />

the resources (running time <strong>and</strong> memory space) required by algorithms,<br />

without having to consider implementation issues. As we have seen, there are<br />

many models of computation, each differing in computing power. In Chap.5<br />

we consider models of computation using <strong>DNA</strong>.<br />

2.5 Data Structures<br />

So far, we have only considered very simple problems, such as computing<br />

powers of integers. However, many “interesting” problems are concerned with<br />

other mathematical constructs. The solution of a computational problem often<br />

involves the determination of some property (or properties) of a given<br />

mathematical structure. Such structures include lists, networks, <strong>and</strong> trees.<br />

These are examples of data structures. A data structure is a way of organizing<br />

information (usually, but not always, in computer memory) in a selfcontained<br />

<strong>and</strong> organized fashion. Data structures have algorithms associated<br />

with them to access <strong>and</strong> maintain the information they contain. For example,<br />

one of the simplest data structures is the array. Arrays are used when we need<br />

to store <strong>and</strong> manipulate a collection of items of similar type that may have<br />

different attributes. Consider a set of mailboxes, or “pigeon-holes.” Each is<br />

identical (i.e., of the same type), but may have different contents (attributes).<br />

In addition, each mailbox has a unique number, or address. These principles<br />

hold just as well if, for example, we wish to store a list of integers for use<br />

within an algorithm. Rather than declaring an individual variable for each<br />

integer stored, we simply declare an array of integers that is large enough for<br />

our purposes.<br />

Consider an example: we wish to store the average annual rainfall in our<br />

country (rounded up to the nearest centimeter) over a ten-year period. We<br />

could declare a separate variable for each year to store the rainfall over that<br />

period, but this would be unwieldy <strong>and</strong> inefficient. A much better solution is<br />

to declare an array of ten integers, each storing one year’s rainfall. Thus, we<br />

may declare an array called rainfall, addressing the elements as rainfall[0],<br />

rainfall[1], ..., rainfall[9]. Note how the first element of an n-element array<br />

always has address 0, <strong>and</strong> the last has the address n-1.<br />

Arrays may be multi-dimensional, allowing us to represent more complex<br />

information structures. For example, we may wish to write an algorithm to calculate<br />

the driving distances between several towns. The first problem we face<br />

is how to represent the information about the towns <strong>and</strong> the roads connecting

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

Saved successfully!

Ooh no, something went wrong!