2.3 Measuring Computation Time 21
of computers. This branch of complexity theory must, however, be left for
more specialized monographs (see Nielsen and Chuang (2000)).
In the area of digital computers then, upper or lower bounds for register
machines imply similar bounds for all actual computers. Later we will need
yet another model of computation. Register machines have free access (re-
ferred to as random access) to their memory: on input i it is possible to read
the contents of the ith storage cell (formerly called a register). This global
access to storage will cause us problems. Therefore, a very restricted model
of computation will be introduced as an intermediate model. In this model,
computation steps have only local effects, and this is precisely what simplifies
our work.
The Turing machine model goes back to the English logician Alan Turing.
Not only did his work provide the basis for the building of computers, but
during World War II he also led a group that cracked the German secret code
“Enigma”. As in all models of computation, we assume unbounded space
for the storage of data. For a Turing machine, this storage space is divided
into cells which are linearly arranged, and each assigned an integer i ∈ Z
consecutively. This linearly arranged storage space is referred to as a tape.At
each step, the Turing machine has access to one of these tape cells. In addition,
a Turing machine has a separate finite storage space (its “memory”) which it
can access at any time. In a single step, the Turing machine can modify its
memory and the contents of the tape cell it is reading and then move to the
left or right neighboring tape cell. Formally, a Turing machine consists of the
following components:
• a finite state space Q,wherebyeachq ∈ Q represents a state of the memory,
and so a memory that can hold k bits can be described by Q = {0, 1}
k
;
• an initial state q
0
∈ Q;
• a finite input alphabet Σ;
• a finite tape alphabet Γ which contains at least the symbols in Σ and an
additional blank symbol b ∈ Σ;
• a program δ : Q × Γ → Q × Γ ×{−1, 0, 1};and
• a set of halting states Q
⊆ Q,whereδ(q, a)=(q, a,0) for all (q, a) ∈
Q
× Γ , but δ(q,a) =(q,a,0) for all (q, a) ∈ (Q − Q
) × Γ .
The Turing machine works as follows: Initially, the input x =(x
1
,...,x
n
) ∈
Σ
n
is in the tape cells 0, 1,...,n− 1, and all other cells contain the blank
symbol; the memory is in state q
0
; and the machine is reading tape cell 0. At
every step, if the machine is in state q, reading symbol a in tape cell i,and
δ(q, a)=(q
,a
,j), then symbol a is replaced by symbol a
, state q is replaced
by state q
, and cell i + j is read in the next step. Although formally a Turing
machine continues to process when it is in a halting state, the computation
time is defined as the first point in time that the machine reaches a halting
state. For search problems, the output is located in cells 1,...,m,wherem is
the least positive integer such that tape cell m + 1 contains the blank symbol.
For decision problems we can integrate the output into the state by partition-