#Computational_Theory

1. Fundamental definitions:

Algorithm introduction:

Definition 1.1:

  • An algorithm is a finite sequence of precise instructions for performing a computation or for solving a problem.

Properties of algorithm:

  • Input: An algorithm has input values from a specified set.
  • Output: From each set of input values an algorithm produces output valus from a specified set. The output values are the solution to the problem.
  • Definiteness: The steps of an algorithm must be defined precisely.
  • Correctness: An algorithm should produce the correct output values for each set of input values.
  • Finiteness: An algorithm should produce the desired output after a finite (but perhaps large) number of steps for any input in the set.
  • Effectiveness: It must be possible to perform each step of an algorithm exactly and in a finite amount of time.
  • Generality: The procedure should be applicable for all problems of the desired form, not just for a particular set of input values.

Searching algorithms:

  • Searching problem: Locating element x in the list of distinct elements
    • Linear search: Search from the beginning to the end of the list
    • Binary search: Search from the beginning and the end of the list to the middle, continue recursion to each part(divide to 2 parts)
  • Sorting problem: Ordering the elements of a list
    • Bubble sort: Run from the beginning to the end, on the way, if there are any large value -> swap
    • Insertions sort: Sort from the left, every iteration, choose an unsorted element and put to the right order of the sorted list on the left.

Greed and optimization:

  • Optimization problem: Finding optimal (minimum, maximum) to the given problem.
  • Coin change example:

Lemma 1.2:

  • If n is a positive integer, the n cents in change using quarters, dimes, nickels, and pennies using the fewest coin possible has at most two dimes, at most one nickel, at most for pennies, and cannot have two dimes and a nickel. The amount of change in dimes, nickels, and pennies cannot exceed 24 cents.

Theorem 1.3:

  • The greedy algorithm above produces change using the fewest coins possible.

Halting problem:

  • One of the most famous theorem in computer science
  • Halting problem: Is there exists a procedure to determine a computer program will stop of enter into an infinite loop with a specific input
  • Answer: proved by Alan Turing is NO

Grow of the function:

Big O notation:

Definition 2.1:

  • Let f and g be functions from the set of integers or set of real numbers to the set of real numbers. ≥ f(x) is O(g(x)) if there are constants C and k such that:

    |f(x)|≤C|g(x)|

    whenever x>k

Definition 2.2:

  • Limit definition: if g(x) is non zero function, then \displaystyle\lim_{x \to -\infty} \frac{|f(x)|}{g(x)} < \infty

Theorem 2.3:

  • Let f(x)=anxn+an−1xn−1+⋯+a1x+a0f(x) = a_{n}x^{n} + a_{n-1}x^{n-1} + \dots + a_{1}x + a_{{0}}, where a0,a1,…,an−1,ana_{0}, a_{1}, \dots,a_{n-1}, a_{n} are real numbers/ Then f(x) is O(xn)O(x^{n})

Theorem 2.4:

  • Suppose that f1(x)f_{1}(x) is O(g1(x))O(g_{1}(x)) and that f2(x)f_{2}(x) is O(g2(x))O(g_{2}(x)). Then (f1+f2)(x)(f_{1} + f_{2})(x) is O(max(∣g1(x)∣,∣g2(x)∣))O(max(|g_{1}(x)|, |g_{2}(x)|)).

Corollary 2.5:

  • Suppose that f1(x)f_{1}(x) and f2(x)f_{2}(x) are both O(g(x))O(g(x)). Then (f1+f2)(x)(f_{1} + f_{2})(x) is O(g(x))O(g(x)).

Theorem 2.6:

  • Suppose that f1(x)f_{1}(x) is O(g1(x))O(g_{1}(x)) and that

Big-Omega notation:

Definition 2.7:

  • Let f and g be a functions: Z/R−>RZ/R -> R . We say that f(x)f(x) is Ω(g(x))\Omega(g(x)) if there are constants CC and kk such that ∣f(x)∣≥C∣g(x)∣|f(x)| \geq C|g(x)| whenever x > k

Big-Theta notation:

Definition 2.8:

  • Let f and g be a functions: Z/R−>RZ/R -> R .
    • We say that f(x)f(x) is Θ(g(x))\Theta(g(x)) if f(x)f(x) is O(g(x))O(g(x)) and f(x)f(x) is Ω(g(x))\Omega(g(x)).
    • When f(x)f(x) is Θ(g(x))\Theta(g(x)) we say that f is big-Theta of g(x)g(x), that f(x)f(x) is of order g(x)g(x), and that f(x)f(x) and g(x)g(x) are of the same order. C1∣g(x)∣≤∣f(x)∣≤C2∣g(x)∣C_{1}|g(x)|\leq |f(x)| \leq C_{2}|g(x)|

Definition 2.9:

  • Let f(x)=anxn+an−1xn−1+...+a1x+a0f(x) = a_{n}x^{n}+a_{n-1}x^{n-1}+...+a_{1}x+a_{0}, where a0,a1,...,an−1,ana_{0}, a_{1},...,a_{n-1},a_{n} are real number with an!=0a_{n}! = 0. Then f(x)f(x) is of xnx^{n}

The complexity of an algorithm:

Time and space complexity :

Definition 3.1:

  • An analysis of the time required to solve a problem of a particular size involves the time complexity of the algorithm.

Definition 3.2:

  • An analysis of the computer memory required involves the space complexity of the algorithm.

Definition 3.3:

  • The time complexity of an algorithm can be expressed in terms of the number of operations used by the algorithm when the input has a particular size.
  • The operations used to measure time complexity can be the comparison, addition, multiplication, division, or any other basic operation of integers.

Complexity of matrix multiplication:

Built with LogoFlowershow