Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Complexity theory
1. Complexity Theory
Prof. Shashikant V. Athawale
Assistant Professor | Computer Engineering
Department | AISSMS College of Engineering,
Kennedy Road, Pune , MH, India - 411001
2. CONTENTS
1. Asymptotic notation
2. Deterministic Algorithm
3. Non-Deterministic Algorithm
4. Difference between Deterministic Algorithm & Non-Deterministic Algorithm
5. P problems
6. NP problems
7. Difference between P and NP problems
8. 3-Satisfiability
9. Hamiltonian Cycle
4. • The Big O notation defines an upper bound of an algorithm, it bounds
a function only from above. For example, consider the case of
Insertion Sort.
• g(n) is upper bound of the f(n) if there is exists some positive
constants c and n0.It is denoted as f(n)=O(g(n)).
• The Big Omega notation defines an lower bound of an algorithm.
• Running time of the algorithem cannot be less than asymptotic lower
bound for sequence of the data.
• Big Theta defines the tight bound for the algorithem.
• Running time of the algorithem cannot be less than or greater than its
asymptotic tight bound for random sequence of the data.
5. DETERMINISTIC ALGORITHM
• In Deteministic algorithem For a particular input the computer will give same
output every time.
• examples are finding odd or even,sorting,finding max etc.
• Most of the algorithem are deterministic in nature.
6. NON-DETERMINISTIC ALGORITHM
• In non deterministic algorithem for a same input the computer will
give different output on different execution.
• This algorithem operates in two phases Guessing and Verification.
• Randomly picking some elements from the list and check if it is
maximum is non-deterministic.
7. Difference between Deterministic and Non-
deterministic Algorithms
Deterministic Algorithm
• For a particular input the computer will give different output on different
execution.
• Can solve the problem in polynomial time.
Non-deterministic Algorithm
• For a particular input the computer will give different output on different
execution.
• Can’t solve the problem in polynomial time.
8. P and NP class
Problem
P class NP class
NP Complete NP hard
9. P-Class Problem
• The class P consists of those problems that are solvable in polynomial
time, i.e. these problems can be solved in time O(nk) in worst-case,
where k is constant.
• These problems are called tractable, while others are called
intractable or super polynomial.
• The advantages in considering the class of polynomial-time
algorithms is that all reasonable deterministic single processor model
of computation can be simulated on each other with at most a
polynomial slow-d
10. NP-Class Problem
• The class NP consists of those problems that are verifiable in
polynomial time. NP is the class of decision problems for which it is
easy to check the correctness of a claimed answer, with the aid of a
little extra information.
• Every problem in this class can be solved in exponential time using
exhaustive search.
11. Difference between P and NP class problem
• All problems in P can be solved with polynomial time algorithms,
whereas all problems in NP - P are intractable.
• P is set of problems that can be solved by a deterministic Turing
machine in Polynomial time.
• NP is set of decision problems that can be solved by a Non-
deterministic Turing Machine in Polynomial time.
• NP-complete problems are the hardest problems in NP set.
12. NP-complete problems
A decision problem L is NP-complete if:
1) L is in NP (Any given solution for NP-complete problems can be
verified quickly, but there is no efficient known solution).
2) Every problem in NP is reducible to L in polynomial time (Reduction
is defined below).
A problem is NP-Hard if it follows property 2 mentioned above, doesn’t
need to follow property 1. Therefore, NP-Complete set is also a subset
of NP-Hard set.
13. Examples:
• Knapsack problem
• Hamiltonian path problem
• vertex cover problem
• Boolen satisfiabiltiy problem
• clique problem
14. 3-Satisfiability
• Satisfiability's role as the first NP-complete problem implies that the problem
is hard to solve in the worst case, but certain instances of the problem are not
necessarily so tough. .
• Input: A collection of clauses C where each clause contains exactly 3 literals,
over a set of Boolean variables V.
• Output: Is there a truth assignment to V such that each clause is satisfied?
Since this is a more restricted problem than satisfiablity, the hardness of 3-SAT
implies that satisfiability is hard. The converse isn't true, as the hardness of
general satisfiability might depend upon having long clauses. We can show the
hardness of 3-SAT using a reduction that translates every instance of
satisfiability into an instance of 3-S.
15. Hamiltonian Cycle
Hamiltonian Path in an undirected graph is a path that visits each
vertex exactly once.
A Hamiltonian cycle (or Hamiltonian circuit) is a Hamiltonian Path
such that there is an edge (in the graph) from the last vertex to the
first vertex of the Hamiltonian Path.