Scheduling
Computational complexity
Han Hoogeveen, Utrecht University
Terminology
A problem just contains a description of the problem together
with the parameters that describe the input of the problem.
Values have not been assigned to the parameters.
For example: the Partition problem:
Given n non-negative integral values a1 , . . . , an , does there
exist a subset S of the index-set {1, . . . , n}, such that
X
j∈S
aj =
n
X
aj /2?
j=1
The input parameters are n and a1 , . . . , an .
To define an instance of the Partition problem, we need to
assign values to these input parameters.
What are the input parameters for 1|rj |Cmax ?
Input size
To store an instance, you must encode the values of the
parameters.
For the Partition problem, you must encode n together with
the numbers a1 , . . . , an .
If you use a binary encoding, then you need approximately
log A bits with value 0 or 1 encode an integer A. The input
size of an instance of Partition is then something like
n log amax .
If you use a unary encoding, then you need A bits with value
1 to encode an integer A. The input size of an instance of
P
Partition is then something like nj=1 aj .
The input size is used to measure the running time of an
algorithm.
Running time of an algorithm
Suppose we have chosen some problem, and for this problem
we have defined an algorithm to solve it.
Running times can be measured as the time (in seconds) it
takes to solve a given instance, but this is instance-dependent.
We want to have a (rough) estimate of the number of
elementary computations (additions, multiplications,
comparisons, etc.) that are required by the algorithm to solve
the problem in the worst case; this expression will depend on
the values of the parameters (input size).
We use the big O notation to estimate the running time.
Big O notation
Suppose that n is part of the input size.
Let f (n) and g(n) be two non-negative functions of n.
Definition. A function f (n) = O(g(n)) if there exists a
number c > 0 and a bound n0 such that for all n ≥ n0 we
have f (n) ≤ cg(n).
Hence, 3n2 − 10n + 111991 = O(n2 ) and 108 = O(1).
According to the definition, n2 = O(nk ), for all k ≥ 2; in
practice, everybody keeps the exponent k as small as possible
(in Computer Science, Θ is used to bound both from above
and below).
To bound a polynomial function, we use nk and log n (or
log log n, etc.). For example, sorting an array with n integers
can be done in O(n log n) time.
Polynomial versus exponential
An algorithm with running time O(nk ), where k is a given
constant, is called a polynomial algorithm.
An algorithm with running time O(c n ), where c > 1 is a given
constant, is called an exponential algorithm.
In general a polynomial algorithm is preferred over an
exponential algorithm, because of the scalability (effect of
increasing the size of the problem on the running time).
For many problems polynomial algorithms exist, but for many
others they have not been found yet. Major question: are we
to blame when we cannot find a polynomial algorithm for
some problem?
This has been a major topic of research in the area of
Computational Complexity.
N P-completeness
A major achievement of Computational Complexity is to
define classes containing problems with the same properties
with respect to complexity.
The most important one is the class N P (Non-deterministic
Polynomial).
The class N P contains decision problems (answer is ‘yes’ or
‘no’, like the Partition problem).
A decision problem belongs to the class N P if it satisfies the
following constraints:
1
2
An arbitrary solution (leading to either ‘yes’ or ‘no’) can be
encoded in polynomial space with respect to the input size.
Checking whether a given solution leads to ‘yes’ can be done
in polynomial time with respect to the input size.
The Partition problem is part of the class N P.
P versus N P
An optimization problem can be turned into a decision
problem by introducing a threshold value y .
In case of a miminization problem M, the decision variant
becomes:
Given an instance of M together with a threshold value y ,
does there exist a feasible solution with outcome value ≤ y ?
If M can be solved in polynomial time, then its decision
variant can be decided in polynomial time.
Define P as the class of decision problems that can be
decided in polynomial time; clearly P is a subset of N P.
Millennium problem: does P = N P hold?
N P-completeness
Another subset of N P consist of the class of N P-complete
problems. For none of these a polynomial algorithm is known,
and if such an algorithm exists for one of these, then there
exists a polynomial algorithm for each problem in this class.
Cook has shown that Satisfiability is N P-complete.
You can show that a decision problem is N P-complete
through a reduction.
Basically, you show through this reduction that your problem
is a generalization of another problem that is known to be
N P-complete.
General recipe of a reduction
Suppose that you want to show N P-completeness of problem
B; assume that you know that problem A is N P-complete.
Show that B belongs to the class N P.
Take an arbitrary instance of problem A.
Indicate how you can construct a special instance of problem
B on basis of the instance of A that you selected: the
answers to the instance of A and the special instance of
B must be equal.
This construction must be possible in polynomial time.
Reasoning behind this: If you have an algorithm that can
decide any instance of B in polynomial time, then you can use
this to decide any instance of A in polynomial time: P = N P
and eternal fame etc. awaits you.
N P-completeness of Subset Sum
Suppose that we know that the Partition problem is
N P-complete; Partition was defined as:
Given n non-negative integral values a1 , . . . , an , does there
exist a subset S of the index-set {1, . . . , n}, such that
X
aj =
j∈S
n
X
aj /2?
j=1
Subset Sum is a generilization of Partition (or in other
words, Partition is a special case of Subset Sum), and hence
Subset Sum is N P-complete as well. Subset Sum is defined
as follows.
Given t non-negative integral values b1 , . . . , bt and an integer
B, does there exist a subset T of the index-set {1, . . . , t},
such that
X
bj = B?
j∈T
© Copyright 2026 Paperzz