Advanced Algorithms and Complexity: The Complexity Class P: August 3, 2018
Advanced Algorithms and Complexity: The Complexity Class P: August 3, 2018
Lecture 1
The Complexity Class P
August 3, 2018
Alphabets are finite sets of symbols. Examples: the binary alphabet {0, 1}
Strings are concatenation of zero or more symbols from alphabet. Examples
are : (string of length 0),0, 10, 00, 000, 101, 100, 110, .... Length of a string
w is denoted by |w|. For example || = 0 and |110| = 3.
Languages are sets of strings. For example, we can define a language Le as
the set of all binary strings ending in 0: Le = {0, 10, 00, 000, 010, 100, 110, ...}
Turing Machines are a formal model of computation.
Example of a TM: We will design a TM for accepting the language Le as
follows: TM’s have a tape which is divided into cells. For simplicity we are
considering a single-tape TM. We can also have multi-tape TMs having more
than one tape. Again, for simplicity we are assuming that the tape is semi-
infinite tape which starts from a cell having a special start symbol which we
denote by .. We can also have 2−way infinite tape, and also 2−dimensional
tapes. TM has a head that scans a single cell at a time. Initially it scans
the start symbol. In any move of the TM, the head can either move Left
(L), Right (R) or Stay (S) at the current cell. TMs can be in one of possible
(finite) states. Initially, the TM is in the start state which we denote by qs .
With each move TMs can change the state. There is a state called halting
state which we denote by qh . When TM is in qh state, then there is no further
move possible and we say that the TM has accepted its input. If the TM
halts in any other state other than qh , then we say that the TM has rejected
1
its input. TMs can be thought of as an algorithm that takes some input on
its tape and gives some output (yes if it accepts, no if it rejects). The ‘code’
of a TM is the transition function δ which specifies how the TM changes its
state, moves its head, and modifies the current cell on a particular state and
the current cell content. For the example language Le we have:
Le = {0, 00, 10, 000, 010, 100, 110, ...} Initially the TM on input 100 will be:
2
the symbols . and B). Q is the finite set of states (including qs and qh ).
δ : Q×Γ → (Q, Γ, {L, R, S}) is the transition function specifying the moves of
the DTM. We say that the DTM accepts a language L if for any x, x ∈ L =⇒
DTM halts in state qh when started with input x with initial state qs and
head scanning the . symbol. x ∈ / L =⇒ DTM halts in state q ∈ Q − qh
when started with input x with initial state qs and the head scanning the .
symbol.
3
whether z 0 = z in time O(n) with total time complexity as O(n2 )
=⇒ Lmult ∈ P .