Table of Contents

Laborator AA

Part 1 - Decidability - 4 labs

1. Turing Machine

Key concepts:

  1. computation (the output of the tape) and acceptance (acceptare);
  2. mechanical description of an algorithm
  1. (Answers online - discussion) A Turing Machine consists of:
    • an alphabet $ \Sigma$
    • a set of states $ K$
    • an initial state $ q_0$
    • a transition function $ \delta : K \times \Sigma \rightarrow K \times \Sigma \times \{L,H,R\}$
    • a set of final states $ F \subseteq K$

Which of the following components of an assembly language would best correspond to the above? $ K,\Sigma, \delta, q_0, F$

  1. (Answers online) What does the following TM do? (bitwise complement)
  2. (Answers online) Write a TM which accepts only if the input is a binary encoding of a even natural number.
  3. (Answers online) Write a TM which adds 5 to a number encoded in binary on the tape. The machine will always accept.
  4. (Answers online) Check if a symbol is present on the tape.
  5. (Discussion) How would the following algorithm be represented as a Turing Machine:
Algorithm(vector V, integer M) {
   integer s = 0
   for-each x in V
      s += x
   if (x > 1000)
   then  return 1
   else  return 0
}

Helpful questions:

Homework:

2. Turing Machines and Solvability

Key concepts:

3. The Universal Turing Machine

Key concepts:

Exercises:

Discussion on the pseudocode.

Discussion on the pseudocode

Algoritm(M,w){
   if size(w) > 10
     then if M halts for w in k steps
          accept.
} 
Algoritm(M1,M2,w){
   k = 0
   while true
       if M1(w) has the same behaviour as M2(w) after k steps
          then accept
       else k = k + 1
} 
Algorithm(M,A) {
   // A is a finite set of words
   for each w in A
       if M(w) halts  //undecidable! Pseudocode is ok, but this machine may not terminate
          then accept
}
Algorithm(M,w) {
   build the machine M' such that M(x) accepts iff M'(x) does not accept, for all words x
   if M'(w) in 1000 steps
      accept
}
Algorithm(M1,M2) {
    if M1 always halts then     //we know of no procedure, terminating or not, which can achieve this. This is not a proper TM/algorithm.
       if M2 always halts then 
          accept
}

Homework:

Von Newmann Model

4. Undecidable problems

Key concept:

Part 2 - Measuring algorithm performance (3 labs)

Notatii asimptotice

Recurente

Ammortised Analysis

Part 3 - Algorithm complexity (4 labs)

NP completitudine

Part 4 - Abstract Datatypes (2 labs)

TDA-uri