CS301 Complexity of Algorithms

Lecture 1

October 3rd, 2017

4+5=...4 + 5 = ...” is not an algorithmic problem.
integer addition” is an algorithmic problem.

{0,1}\{0,1\}^\ast is the set of all binary string.

Formally, f:{0,1}×{0,1}{0,1}f : \{0,1\}^\ast \times \{0,1\}^\ast \rightarrow \{0,1\}^\ast.

Lecture 2

October 6th, 2017

All data can be encoded with {0,1}\{0,1\}^\ast. f:{0,1}{0,1}f : \{0,1\}^\ast \rightarrow \{0,1\}^\ast is an algorithmic problem. An algorithm is a solution to said problem.

It has to terminate in a finite number of steps and must be finitely representable.

f:{0,1}{0,1}f : \{0,1\}^\ast \rightarrow \{0,1\} is a decision problem. Very often we can reduce an arbitrary algorithmic problem to a decision problem.

The algorithmic problem dist(a,b)=ndist(a, b) = n, provided you have a finite upper bound, can be calculated through repeated calls to

f(a,b,x)={1,if dist(a,b)x0,otherwise.f(a,b,x)= \begin{cases} 1, & \text{if } dist(a,b)\geq x\\ 0, & \text{otherwise.} \end{cases}

Limits of Computation

Goal: answer whether an algorithmic problem…

  • can be solved by a computer
  • can be solved efficiently by a computer

Notation:

  • x\underline{x} denotes the representation of object xx
  • a pair x,y\langle x,y\rangle can be encoded as x×y\underline{x}\circ\times \circ\underline{y} in the alphabet {0,1,×}\{0,1,\times\}^\ast, then encoded with 0000\rightarrow 00, 1111\rightarrow 11, ×01\times\rightarrow 01.

Decision problem f:{0,1}{0,1}f : \{0,1\}^\ast \rightarrow \{0,1\}, can be identified with language Lf={x:f(x)=1}L_f=\{x:f(x)=1\}. The problem of computing ff is equivalent to deciding LfL_f.

Reduce TSPTSP to Hamiltonian cycle test: weight 1 on non-edges, 0 on edges.

TSP(G)=0Hamiltonian cycleTSP(G) = 0 \Rightarrow \text{Hamiltonian cycle}

Elemental operations:

  1. Read a bit from input or scratch pad.
  2. Write bit to scratch pad.
  3. Either stop, output 0 or 1, or choose a new rule that will be applied next (branching).