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.

2.6 <strong>Computation</strong>al Complexity 41<br />

state. We therefore describe the running time of an algorithm using “big-oh”<br />

notation, which allows us to hide constant factors, such as the average number<br />

of machine instructions generated by a particular compiler <strong>and</strong> the average<br />

time taken for a particular machine to execute an instruction. So, rather than<br />

saying that the factoring algorithm takes 5 + (n ∗ 3) time, we strip out the<br />

constants <strong>and</strong> say it takes O(n) 1 time.<br />

The importance of this method of measuring complexity lies in determining<br />

whether of not an algorithm is suitable for a particular task. The fundamental<br />

question is whether or not an algorithm will be too slow given a big enough<br />

input, regardless of the efficiency of the implementation or the speed of the<br />

machine on which it will run.<br />

Consider two algorithms for sorting numbers. The first, quicksort [48, page<br />

145] runs, on average, in time O(nlogn). The second, bubble sort [92], runs in<br />

O(n 2 ). To sort a million numbers, quicksort takes, on average, 6,000,000 steps,<br />

while bubble sort takes 1,000,000,000,000. Consequently, quicksort running on<br />

a home computer will beat bubble sort running on a supercomputer!<br />

An unfortunate tendency among those unfamiliar with computational<br />

complexity theory is to argue for “throwing” more computer power at a problem<br />

until it yields. Difficult problems can be cracked with a fast enough supercomputer,<br />

they reason. The only problems lie in waiting for technology to<br />

catch up or finding the money to pay for the upgrade. Unfortunately, this is<br />

far from the case.<br />

Consider the problem of satisfiability (SAT) [48, page 996]. We formally<br />

define SAT in the next chapter, but for now consider the following problem.<br />

Given the circuit depicted in Fig. 2.15, is there a set of values for the variables<br />

(inputs) x <strong>and</strong> y that result in the circuit’s output z having the value 1?<br />

X<br />

Y<br />

1 Read “big-oh of n”, or “oh of n”.<br />

Fig. 2.15. Satisfiability circuit<br />

Z

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

Saved successfully!

Ooh no, something went wrong!